Gtk: Add clear recent items item.

This commit is contained in:
BearOso 2023-03-11 17:46:40 -06:00
parent 87bb383797
commit 22e0b373e4
2 changed files with 21 additions and 0 deletions

View File

@ -1388,6 +1388,18 @@ void Snes9xWindow::show()
});
recent_menu->show();
auto clear_recent = get_object<Gtk::MenuItem>("clear_recent_items");
clear_recent->signal_activate().connect([&] {
auto manager = Gtk::RecentManager::get_default();
auto items = manager->get_items();
for (auto &i : items)
{
auto groups = i->get_groups();
if (groups.end() != std::find_if(groups.begin(), groups.end(), [](Glib::ustring &name) -> bool { return name == "cartridge"; }))
manager->remove_item(i->get_uri());
}
});
}
}

View File

@ -1223,6 +1223,15 @@
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="clear_recent_items">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Clear Recent Items</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
<property name="visible">True</property>