class MenuBar(gtk.UIManager): """ A menu bar using the UIManager. """ def __init__(self, parent): """ A constructor for the menu bar. """ self.parent = parent actions = [ ( "ActionsMenu", None, "_Actions" ), ( "About", gtk.STOCK_ABOUT, "_About", None, None, self.on_about_menuitem_clicked), ( "HelpMenu", None, "_Help" ), ( "EditMenu", None, "_Edit" ), ( "Quit", gtk.STOCK_QUIT, "_Quit", None, None, self.on_quit_menuitem_clicked), ( "AddContact", gtk.STOCK_ADD, "_Add contact...", None, None, self.on_add_contact_menuitem_clicked), ( "ChangeAvatar", None, "_Change avatar...", None, None, self.on_change_avatar_menuitem_clicked), ( "Preferences", gtk.STOCK_PREFERENCES, "_Preferences", None, None, self.on_preferences_menuitem_clicked), ] checkactions = [ ( "ShowOfflineContacts", None, "Show _Offline Contacts", None, None, self.on_show_offline_contacts_clicked), ] actiongroup = gtk.ActionGroup("MenubarActions") actiongroup2 = gtk.ActionGroup("CheckActions") actiongroup.add_actions(actions) actiongroup2.add_actions(checkactions) actiongroup2.get_action("ShowOfflineContacts").set_menu_item_type(gtk.CheckMenuItem) gtk.UIManager.__init__(self) self.insert_action_group(actiongroup, -1) self.insert_action_group(actiongroup2, -1) self.add_ui_from_string( \ '' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ ' ' \ '') def new(self): self.ensure_update()