mirror of https://github.com/snes9xgit/snes9x.git
Gtk: Add clear recent items item.
This commit is contained in:
parent
87bb383797
commit
22e0b373e4
|
@ -1388,6 +1388,18 @@ void Snes9xWindow::show()
|
||||||
});
|
});
|
||||||
|
|
||||||
recent_menu->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());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1223,6 +1223,15 @@
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</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>
|
<child>
|
||||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
Loading…
Reference in New Issue