aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2015-04-03 13:21:44 -0500
committerCharles Kerr <charles.kerr@canonical.com>2015-04-03 13:21:44 -0500
commit456e5fa5e94e5afd5a2084453d0c7f1f12dae692 (patch)
treee94584fc02f121d7080d646de5aeb8f567b16f47
parent8c7daeeb87abd0be1b96169da18baf018c4859c9 (diff)
parent9f48c6479a17771597544adc36eac968b9b5c027 (diff)
downloadayatana-indicator-datetime-456e5fa5e94e5afd5a2084453d0c7f1f12dae692.tar.gz
ayatana-indicator-datetime-456e5fa5e94e5afd5a2084453d0c7f1f12dae692.tar.bz2
ayatana-indicator-datetime-456e5fa5e94e5afd5a2084453d0c7f1f12dae692.zip
sync with trunk
-rw-r--r--data/com.canonical.indicator.datetime.gschema.xml.in2
-rw-r--r--debian/changelog9
-rw-r--r--src/awake.cpp63
-rw-r--r--tests/test-exporter.cpp2
4 files changed, 59 insertions, 17 deletions
diff --git a/data/com.canonical.indicator.datetime.gschema.xml.in b/data/com.canonical.indicator.datetime.gschema.xml.in
index edcede2..044f694 100644
--- a/data/com.canonical.indicator.datetime.gschema.xml.in
+++ b/data/com.canonical.indicator.datetime.gschema.xml.in
@@ -148,7 +148,7 @@
</key>
<key name="alarm-duration-minutes" type="u">
<range min="1" max="60"/>
- <default>30</default>
+ <default>10</default>
<_summary>The alarm's duration.</_summary>
<_description>
How long the alarm's sound will be looped if its snap decision is not dismissed by the user.
diff --git a/debian/changelog b/debian/changelog
index 40df883..62a5b4e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+indicator-datetime (13.10.0+15.04.20150331-0ubuntu1) vivid; urgency=medium
+
+ [ Charles Kerr ]
+ * Reduce the forced screen-on time for alarms to reduce battery
+ consumption. Also, lower the default alarm duration from 30 minutes
+ to 10 minutes. (LP: #1434637)
+
+ -- CI Train Bot <ci-train-bot@canonical.com> Tue, 31 Mar 2015 20:25:38 +0000
+
indicator-datetime (13.10.0+15.04.20150317-0ubuntu1) vivid; urgency=medium
[ Charles Kerr ]
diff --git a/src/awake.cpp b/src/awake.cpp
index 57358ab..e1bec6c 100644
--- a/src/awake.cpp
+++ b/src/awake.cpp
@@ -48,10 +48,16 @@ public:
g_cancellable_cancel (m_cancellable);
g_object_unref (m_cancellable);
+ if (m_display_on_timer)
+ {
+ g_source_remove (m_display_on_timer);
+ m_display_on_timer = 0;
+ }
+
if (m_system_bus != nullptr)
{
unforce_awake ();
- unforce_screen ();
+ remove_display_on_request ();
g_object_unref (m_system_bus);
}
}
@@ -106,7 +112,7 @@ private:
G_DBUS_CALL_FLAGS_NONE,
-1,
self->m_cancellable,
- on_force_screen_response,
+ on_keep_display_on_response,
self);
g_object_unref (system_bus);
@@ -146,9 +152,9 @@ private:
}
}
- static void on_force_screen_response (GObject * connection,
- GAsyncResult * res,
- gpointer gself)
+ static void on_keep_display_on_response (GObject * connection,
+ GAsyncResult * res,
+ gpointer gself)
{
GError * error;
GVariant * args;
@@ -171,14 +177,29 @@ private:
{
auto self = static_cast<Impl*>(gself);
- self->m_screen_cookie = NO_SCREEN_COOKIE;
- g_variant_get (args, "(i)", &self->m_screen_cookie);
- g_debug ("m_screen_cookie is now '%d'", self->m_screen_cookie);
+ self->m_display_on_cookie = NO_DISPLAY_ON_COOKIE;
+ g_variant_get (args, "(i)", &self->m_display_on_cookie);
+ g_debug ("m_display_on_cookie is now '%d'", self->m_display_on_cookie);
+
+ self->m_display_on_timer = g_timeout_add_seconds (self->m_display_on_seconds,
+ on_display_on_timer,
+ gself);
g_variant_unref (args);
}
}
+ static gboolean on_display_on_timer (gpointer gself)
+ {
+ auto self = static_cast<Impl*>(gself);
+
+ self->m_display_on_timer = 0;
+ self->remove_display_on_request();
+
+ return G_SOURCE_REMOVE;
+ }
+
+
void unforce_awake ()
{
g_return_if_fail (G_IS_DBUS_CONNECTION(m_system_bus));
@@ -202,18 +223,18 @@ private:
}
}
- void unforce_screen ()
+ void remove_display_on_request ()
{
g_return_if_fail (G_IS_DBUS_CONNECTION(m_system_bus));
- if (m_screen_cookie != NO_SCREEN_COOKIE)
+ if (m_display_on_cookie != NO_DISPLAY_ON_COOKIE)
{
g_dbus_connection_call (m_system_bus,
BUS_SCREEN_NAME,
BUS_SCREEN_PATH,
BUS_SCREEN_INTERFACE,
"removeDisplayOnRequest",
- g_variant_new("(i)", m_screen_cookie),
+ g_variant_new("(i)", m_display_on_cookie),
nullptr,
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -221,7 +242,7 @@ private:
nullptr,
nullptr);
- m_screen_cookie = NO_SCREEN_COOKIE;
+ m_display_on_cookie = NO_DISPLAY_ON_COOKIE;
}
}
@@ -229,9 +250,21 @@ private:
GCancellable * m_cancellable = nullptr;
GDBusConnection * m_system_bus = nullptr;
char * m_awake_cookie = nullptr;
- int32_t m_screen_cookie = NO_SCREEN_COOKIE;
- static constexpr int32_t NO_SCREEN_COOKIE { std::numeric_limits<int32_t>::min() };
+ /**
+ * As described by bug #1434637, alarms should have the display turn on,
+ * dim, and turn off "just like it would if you'd woken it up yourself".
+ * USC may be adding an intent-based bus API to handle this use case,
+ * e.g. turnDisplayOnTemporarily(intent), but there's no timeframe for it.
+ *
+ * Until that's avaialble, we can get close to Design's specs by
+ * requesting a display-on cookie and then releasing the cookie
+ * a moment later. */
+ const guint m_display_on_seconds = 1;
+ guint m_display_on_timer = 0;
+ int32_t m_display_on_cookie = NO_DISPLAY_ON_COOKIE;
+
+ static constexpr int32_t NO_DISPLAY_ON_COOKIE { std::numeric_limits<int32_t>::min() };
};
/***
@@ -239,7 +272,7 @@ private:
***/
Awake::Awake(const std::string& app_name):
- impl(new Impl (app_name))
+ impl(new Impl(app_name))
{
}
diff --git a/tests/test-exporter.cpp b/tests/test-exporter.cpp
index be8fcc3..d5118ac 100644
--- a/tests/test-exporter.cpp
+++ b/tests/test-exporter.cpp
@@ -222,7 +222,7 @@ TEST_F(ExporterFixture, AlarmProperties)
g_clear_pointer (&haptic, g_free);
/***
- **** Try chaning the DBus properties -- do the Settings change to match it?
+ **** Try changing the DBus properties -- do the Settings change to match it?
***/
expected_volume = 100;