Created
August 26, 2012 20:24
-
-
Save wolfv/3483363 to your computer and use it in GitHub Desktop.
Gtk Recent Chooser Menu Fail's
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from gi.repository import Gtk | |
class RecentChooserMenu: | |
def __init__(self): | |
window = Gtk.Window() | |
manager = Gtk.RecentManager.get_default() | |
self.recentchooser = Gtk.RecentChooserMenu.new_for_manager(manager) | |
menubar = Gtk.MenuBar() | |
file_menuitem = Gtk.MenuItem("Recent Items") | |
menubar.append(file_menuitem) | |
file_menuitem.set_submenu(self.recentchooser) | |
window.connect("destroy", lambda w: Gtk.main_quit()) | |
self.recentchooser.connect("item-activated", self.display_info) | |
window.add(menubar) | |
window.show_all() | |
def display_info(self, widget): | |
selected = self.recentchooser.get_current_item() | |
print "Display name:", selected.get_display_name() | |
print "File URI:", selected.get_uri() | |
print "Last application:", selected.last_application() | |
RecentChooserMenu() | |
Gtk.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment