diff src/browser/sat_browser/contact.py @ 498:60be99de3808

browser_side: menus refactorization + handle levels > 2
author souliane <souliane@mailoo.org>
date Fri, 25 Jul 2014 02:38:30 +0200
parents 587fe75d1b16
children db3436c85fb1
line wrap: on
line diff
--- a/src/browser/sat_browser/contact.py	Thu Jul 24 12:20:36 2014 +0200
+++ b/src/browser/sat_browser/contact.py	Fri Jul 25 02:38:30 2014 +0200
@@ -96,13 +96,6 @@
 
 class ContactMenuBar(base_widget.WidgetMenuBar):
 
-    ITEM_TPL = "<img src='media/icons/misc/%s.png' />"
-
-    def __init__(self, host, menu_data):
-        base_widget.WidgetMenuBar.__init__(self, host)
-        self.addCachedMenus(C.MENU_ROSTER_JID_CONTEXT, menu_data)
-        self.addCachedMenus(C.MENU_JID_CONTEXT, menu_data)
-
     def onBrowserEvent(self, event):
         base_widget.WidgetMenuBar.onBrowserEvent(self, event)
         event.stopPropagation()  # prevent opening the chat dialog
@@ -128,7 +121,11 @@
             self.click_listener = click_listener
 
         if handle_menu:
-            extra.add(ContactMenuBar(host, {'jid': jid}))
+            extra.add(ContactMenuBar(self, host))
+
+    def addMenus(self, menu_bar):
+        menu_bar.addCachedMenus(C.MENU_ROSTER_JID_CONTEXT, {'jid': self.jid})
+        menu_bar.addCachedMenus(C.MENU_JID_CONTEXT, {'jid': self.jid})
 
     def setMessageWaiting(self, waiting):
         """Show a visual indicator if message are waiting