aboutsummaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-07-21 00:50:24 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-07-21 00:50:24 -0500
commitb08f9b096f956b528ad974a30828a809b827efef (patch)
tree656289e55e8ed415bc552fa99904e240c30744ec /src/service.c
parent6ea2db56307d04ac8dba4bcf929cd716f4840359 (diff)
downloadayatana-indicator-power-b08f9b096f956b528ad974a30828a809b827efef.tar.gz
ayatana-indicator-power-b08f9b096f956b528ad974a30828a809b827efef.tar.bz2
ayatana-indicator-power-b08f9b096f956b528ad974a30828a809b827efef.zip
second draft of low battery power notifications, still a work in progress
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index 7478d0f..d8f1371 100644
--- a/src/service.c
+++ b/src/service.c
@@ -22,8 +22,10 @@
#include <gio/gio.h>
#include <url-dispatcher.h>
+#include "dbus-shared.h"
#include "device.h"
#include "device-provider.h"
+#include "notifier.h"
#include "ib-brightness-control.h"
#include "ib-brightness-uscreen-control.h"
#include "service.h"
@@ -120,6 +122,7 @@ struct _IndicatorPowerServicePrivate
GList * devices; /* IndicatorPowerDevice */
IndicatorPowerDeviceProvider * device_provider;
+ IndicatorPowerNotifier * notifier;
};
typedef IndicatorPowerServicePrivate priv_t;
@@ -821,6 +824,9 @@ on_bus_acquired (GDBusConnection * connection,
p->conn = g_object_ref (G_OBJECT (connection));
+ /* export the battery properties */
+ indicator_power_notifier_set_bus (p->notifier, connection);
+
/* export the actions */
if ((id = g_dbus_connection_export_action_group (connection,
BUS_PATH,
@@ -1001,6 +1007,7 @@ my_dispose (GObject * o)
g_clear_object (&p->settings);
}
+ g_clear_object (&p->notifier);
g_clear_object (&p->brightness_action);
g_clear_object (&p->battery_level_action);
g_clear_object (&p->header_action);
@@ -1035,6 +1042,8 @@ indicator_power_service_init (IndicatorPowerService * self)
p->settings = g_settings_new ("com.canonical.indicator.power");
+ p->notifier = indicator_power_notifier_new (NULL);
+
uscreen_proxy = uscreen_get_proxy(&brightness_params);
if (uscreen_proxy != NULL)
{
@@ -1136,6 +1145,8 @@ indicator_power_service_set_device_provider (IndicatorPowerService * self,
on_devices_changed (self);
}
+
+ indicator_power_notifier_set_device_provider (p->notifier, dp);
}
/* If a device has multiple batteries and uses only one of them at a time,