def create_recent_files_model(recent_manager=None): model = Gio.Menu.new() model.append_section( gettext("Recently opened files"), RecentFilesMenu(recent_manager or Gtk.RecentManager.get_default()), ) return model
def create_recent_files_button(recent_manager=None): button = Gtk.MenuButton() image = Gtk.Image.new_from_icon_name("pan-down-symbolic", Gtk.IconSize.MENU) button.add(image) model = Gio.Menu.new() model.append_section( gettext("Recently opened files"), RecentFilesMenu(recent_manager or Gtk.RecentManager.get_default()), ) popover = Gtk.Popover.new_from_model(button, model) button.set_popover(popover) button.show_all() return button