Some attempt to compile it with new vala, failed
[gregoa/zavai.git] / plugins / 50_sat_monitor.py
index 7100182e324094c22096662345d60a4551e209fa..e44108463806dbf3b5c363fddecf2586d8f11318 100644 (file)
@@ -32,16 +32,16 @@ SAT_QI_NAMES = {
     7: _("receiving data")
 }
 
-class SatelliteMonitor(gtk.VBox, zavai.Applet):
-    def __init__(self, registry, name, **kw):
-        zavai.Applet.__init__(self, registry, name)
-        gtk.VBox.__init__(self)
+class SatelliteMonitor(zavai.Applet):
+    def __init__(self, registry, **kw):
+        super(SatelliteMonitor, self).__init__(registry,
+                "menu.main.gps.satellite_monitor",
+                _("Satellite monitor"))
 
-        self.gps = registry.resource("gps")
+        self.gps = None
 
         self.store = gtk.ListStore(str, str, str, str, str, str, str, str, str, str, str)
         self.view = gtk.TreeView(self.store)
-
         renderer = gtk.CellRendererText()
         for idx, name in enumerate((_("CH"), _("ID"), _("SN"), _("ELE"), _("AZI"),
                      _("Used"), _("Diff"), _("Alm"), _("Eph"),
@@ -50,15 +50,18 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
             col.pack_start(renderer, False)
             col.add_attribute(renderer, "text", idx)
             self.view.append_column(col)
+        self.add(self.view)
 
-        self.pack_start(self.view, True, True)
-        self.pack_start(self.make_parent_link(), False, False)
+    def init(self):
+        self.gps = self.zavai_registry.resource("gps")
 
     def start(self, *args):
-        self.gps.monitor.connect(self.on_ubxdebug_packet)
+        if self.gps is None:
+            self.init()
+        self.gps.monitor.connect("satellites", self.on_ubxdebug_packet)
 
     def stop(self, *args):
-        self.gps.monitor.disconnect(self.on_ubxdebug_packet)
+        self.gps.monitor.disconnect("satellites", self.on_ubxdebug_packet)
 
     def on_ubxdebug_packet(self, clid, length, data):
         # In zhone it is cbUBXDebugPacket
@@ -99,4 +102,4 @@ class SatelliteMonitor(gtk.VBox, zavai.Applet):
                 qi])
 
 def init(conf = None, registry = None, **kw):
-    registry.register_factory("menu.main.gps.satellite_monitor", SatelliteMonitor, _("Satellite monitor"))
+    registry.register(SatelliteMonitor(registry))