diff --git a/src/Indicator.vala b/src/Indicator.vala index e802a672..b10541b4 100644 --- a/src/Indicator.vala +++ b/src/Indicator.vala @@ -13,6 +13,7 @@ public class Notifications.Indicator : Wingpanel.Indicator { private static GLib.Settings? keybinding_settings; private Gee.HashMap app_settings_cache; private GLib.Settings notify_settings; + private SimpleActionGroup action_group; private GLib.ListStore list_store; private Gtk.SortListModel sort_list_model; @@ -57,6 +58,12 @@ public class Notifications.Indicator : Wingpanel.Indicator { add_entry (notification); } }); + + var clear_all_action = new SimpleAction ("clear-all", null); + clear_all_action.activate.connect (clear_all); + + action_group = new SimpleActionGroup (); + action_group.add_action (clear_all_action); } public override Gtk.Widget get_display_widget () { @@ -105,9 +112,9 @@ public class Notifications.Indicator : Wingpanel.Indicator { public override Gtk.Widget? get_widget () { if (nlist == null) { nlist = new NotificationsList (sort_list_model); - nlist.clear_all.connect (clear_all); nlist.close_popover.connect (() => close ()); nlist.remove_notification.connect (remove_notification); + nlist.insert_action_group (Wingpanel.Indicator.MESSAGES, action_group); } return nlist; diff --git a/src/Widgets/NotificationsList.vala b/src/Widgets/NotificationsList.vala index db205dfd..31c7de96 100644 --- a/src/Widgets/NotificationsList.vala +++ b/src/Widgets/NotificationsList.vala @@ -5,7 +5,6 @@ public class Notifications.NotificationsList : Granite.Bin { public signal void remove_notification (Notification notification); - public signal void clear_all (); public signal void close_popover (); public const string ACTION_GROUP_PREFIX = "notifications-list"; @@ -32,6 +31,7 @@ public class Notifications.NotificationsList : Granite.Bin { }; clear_all_btn = new Wingpanel.PopoverMenuItem () { + action_name = Wingpanel.Indicator.MESSAGES + ".clear-all", text = _("Clear All Notifications") }; @@ -99,7 +99,6 @@ public class Notifications.NotificationsList : Granite.Bin { var settings = new GLib.Settings ("io.elementary.notifications"); settings.bind ("do-not-disturb", not_disturb_switch, "active", DEFAULT); - clear_all_btn.clicked.connect (() => clear_all ()); settings_btn.clicked.connect (show_settings); }