Fix strength propagation

This commit is contained in:
Marco Pesenti Gritti 2007-02-25 15:05:56 +01:00
parent f907ceeae6
commit 10bfe004a8
5 changed files with 17 additions and 9 deletions

View File

@ -108,6 +108,8 @@ class Network(gobject.GObject):
logging.debug("Net(%s): ssid '%s', mode %d, strength %d" % (self._op, logging.debug("Net(%s): ssid '%s', mode %d, strength %d" % (self._op,
self._ssid, self._mode, self._strength)) self._ssid, self._mode, self._strength))
self.emit('strength-changed')
def _update_error_cb(self, err): def _update_error_cb(self, err):
logging.debug("Net(%s): failed to update. (%s)" % (self._op, err)) logging.debug("Net(%s): failed to update. (%s)" % (self._op, err))
self._valid = False self._valid = False

View File

@ -37,7 +37,7 @@ class AccessPointModel(gobject.GObject):
self._strength_changed_cb) self._strength_changed_cb)
def _strength_changed_cb(self, nm_network): def _strength_changed_cb(self, nm_network):
self.notity('strength') self.notify('strength')
def get_id(self): def get_id(self):
return self._nm_network.get_op() return self._nm_network.get_op()

View File

@ -15,8 +15,8 @@ class Device(device.Device):
self._nm_device.connect('strength-changed', self._nm_device.connect('strength-changed',
self._strength_changed_cb) self._strength_changed_cb)
def _strength_changed_cb(self, nm_device): def _strength_changed_cb(self, nm_device, strength):
self.notity('strength') self.notify('strength')
def do_get_property(self, pspec): def do_get_property(self, pspec):
if pspec.name == 'strength': if pspec.name == 'strength':

View File

@ -31,6 +31,12 @@ class AccessPointView(CanvasIcon):
self._model = model self._model = model
self.connect('activated', self._activate_cb) self.connect('activated', self._activate_cb)
model.connect('notify::strength', self._strength_changed_cb)
self._update_icon()
def _strength_changed_cb(self, model, pspec):
self._update_icon() self._update_icon()
def _activate_cb(self, icon): def _activate_cb(self, icon):

View File

@ -319,12 +319,12 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
def get_popup(self): def get_popup(self):
if self._tooltip: if self._tooltip:
tooltip_popup = Popup() tooltip_popup = Popup()
canvas_text = hippo.CanvasText(text=self._tooltip) text = hippo.CanvasText(text=self._tooltip)
canvas_text.props.background_color = color.MENU_BACKGROUND.get_int() text.props.background_color = color.MENU_BACKGROUND.get_int()
canvas_text.props.color = color.LABEL_TEXT.get_int() text.props.color = color.LABEL_TEXT.get_int()
canvas_text.props.font_desc = font.DEFAULT.get_pango_desc() text.props.font_desc = font.DEFAULT.get_pango_desc()
canvas_text.props.padding = units.points_to_pixels(5) text.props.padding = units.points_to_pixels(5)
tooltip_popup.append(canvas_text) tooltip_popup.append(text)
return tooltip_popup return tooltip_popup
else: else: