From 9c061ec3b23dc828ecdf8a14ecfdb0a6627f7c32 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 20 Mar 2014 13:18:34 -0500 Subject: add debug logging of what capabilities the notification server said it supports. --- src/snap.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/snap.cpp b/src/snap.cpp index 5cf6063..5df31c9 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -186,8 +186,16 @@ std::set get_server_caps() { std::set caps_set; auto caps_gl = notify_get_server_caps(); + std::string caps_str; for(auto l=caps_gl; l!=nullptr; l=l->next) + { caps_set.insert((const char*)l->data); + + caps_str += (const char*) l->data;; + if (l->next != nullptr) + caps_str += ", "; + } + g_debug ("%s notify_get_server() returned [%s]", G_STRFUNC, caps_str.c_str()); g_list_free_full(caps_gl, g_free); return caps_set; } -- cgit v1.2.3 From 821f2e1a3fe0e7020bd8dcb1f4fbf8e5c4398314 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 20 Mar 2014 13:23:43 -0500 Subject: Don't play the alarm sound if we can't talk to libnotify. Otherwise we won't know when the notification's been closed to turn off the sound, and the sound will play forever. --- src/snap.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') 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; } } -- cgit v1.2.3