예제 #1
0
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
예제 #2
0
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