diff options
-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 5df31c9..3ab2941 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -230,7 +230,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; @@ -250,16 +250,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; } /** @@ -282,8 +285,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; } } |