Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Indicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class Notifications.Indicator : Wingpanel.Indicator {
private static GLib.Settings? keybinding_settings;
private Gee.HashMap<string, Settings> app_settings_cache;
private GLib.Settings notify_settings;
private SimpleActionGroup action_group;

private GLib.ListStore list_store;
private Gtk.SortListModel sort_list_model;
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/Widgets/NotificationsList.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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")
};

Expand Down Expand Up @@ -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);
}

Expand Down
Loading