aboutsummaryrefslogtreecommitdiff
path: root/src/snap.cpp
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-02-26 14:45:46 -0600
committerCharles Kerr <charles.kerr@canonical.com>2014-02-26 14:45:46 -0600
commit115955981f63e477b5a82c07038a1fae55b423d0 (patch)
treea8948c0d0e47461d9fa24d740e5a51f4114beda9 /src/snap.cpp
parentbb4bb77908d8ccd80260aee4541e45d0a075b0ad (diff)
downloadayatana-indicator-datetime-115955981f63e477b5a82c07038a1fae55b423d0.tar.gz
ayatana-indicator-datetime-115955981f63e477b5a82c07038a1fae55b423d0.tar.bz2
ayatana-indicator-datetime-115955981f63e477b5a82c07038a1fae55b423d0.zip
tie the stop-the-ringtone action to the notification being closed, so that it stops no matter which button was pressed.
Diffstat (limited to 'src/snap.cpp')
-rw-r--r--src/snap.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/snap.cpp b/src/snap.cpp
index f2d075a..655fc70 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -157,18 +157,21 @@ struct SnapData
void on_snap_show(NotifyNotification*, gchar* /*action*/, gpointer gdata)
{
- stop_alarm_sound();
auto data = static_cast<SnapData*>(gdata);
data->show(data->appointment);
}
void on_snap_dismiss(NotifyNotification*, gchar* /*action*/, gpointer gdata)
{
- stop_alarm_sound();
auto data = static_cast<SnapData*>(gdata);
data->dismiss(data->appointment);
}
+void on_snap_closed(NotifyNotification*, gpointer)
+{
+ stop_alarm_sound();
+}
+
void snap_data_destroy_notify(gpointer gdata)
{
delete static_cast<SnapData*>(gdata);
@@ -188,6 +191,7 @@ void show_snap_decision(SnapData* data)
notify_notification_set_hint_string(nn, "x-canonical-private-button-tint", "true");
notify_notification_add_action(nn, "show", _("Show"), on_snap_show, data, nullptr);
notify_notification_add_action(nn, "dismiss", _("Dismiss"), on_snap_dismiss, data, nullptr);
+ g_signal_connect(G_OBJECT(nn), "closed", G_CALLBACK(on_snap_closed), data);
g_object_set_data_full(G_OBJECT(nn), "snap-data", data, snap_data_destroy_notify);
GError * error = nullptr;