diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-03-21 05:22:45 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-03-21 05:22:45 +0000 |
commit | c64ae00610f8f607bb1c155c198a081cb2a09f95 (patch) | |
tree | d5a3ebbb8de8f20d7ac412a0c5d7f19f414f07aa /src/snap.cpp | |
parent | 75729a4dda25141e860128ef3547c5946f7c4a5d (diff) | |
parent | 821f2e1a3fe0e7020bd8dcb1f4fbf8e5c4398314 (diff) | |
download | ayatana-indicator-datetime-c64ae00610f8f607bb1c155c198a081cb2a09f95.tar.gz ayatana-indicator-datetime-c64ae00610f8f607bb1c155c198a081cb2a09f95.tar.bz2 ayatana-indicator-datetime-c64ae00610f8f607bb1c155c198a081cb2a09f95.zip |
If we notify_notification_show() fails, we shouldn't play the alarm sound.
The alarm sound loops until the user dismisses it, which will never happen if we can't talk to unity-notiifications. So the outcome in this error case is that the alarm plays forever and can't be dismissed by the user. Fixes: 1295237
Diffstat (limited to 'src/snap.cpp')
-rw-r--r-- | src/snap.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/snap.cpp b/src/snap.cpp index 5cf6063..899581b 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -222,7 +222,7 @@ NotifyMode get_notify_mode() return mode; } -void show_notification (SnapData* data, NotifyMode mode) +bool show_notification (SnapData* data, NotifyMode mode) { const Appointment& appointment = data->appointment; @@ -242,16 +242,19 @@ void show_notification (SnapData* data, NotifyMode mode) } g_object_set_data_full(G_OBJECT(nn), "snap-data", data, snap_data_destroy_notify); + bool shown = true; GError * error = nullptr; notify_notification_show(nn, &error); if (error != NULL) { - g_warning("Unable to show snap decision for '%s': %s", body.c_str(), error->message); + g_critical("Unable to show snap decision for '%s': %s", body.c_str(), error->message); g_error_free(error); data->show(data->appointment); + shown = false; } g_free(title); + return shown; } /** @@ -274,8 +277,8 @@ void notify(const Appointment& appointment, break; default: - show_notification(data, NOTIFY_MODE_SNAP); - play_alarm_sound(); + if (show_notification(data, NOTIFY_MODE_SNAP)) + play_alarm_sound(); break; } } |