Codebase list xapp / c1e2b64
mate applet: Use name+path for icon keys instead of just the name. This is necessary now that multiple icons can appear under the same name. Michael Webster 2 years ago
1 changed file(s) with 17 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
371371 self.monitor.connect("icon-added", self.on_icon_added)
372372 self.monitor.connect("icon-removed", self.on_icon_removed)
373373
374 def make_key(self, proxy):
375 name = proxy.get_name()
376 path = proxy.get_object_path()
377
378 print("Key: %s" % (name+path))
379 return name + path
380
374381 def destroy_monitor (self):
375382 for key in self.indicators.keys():
376383 self.indicator_box.remove(self.indicators[key])
379386 self.indicators = {}
380387
381388 def on_icon_added(self, monitor, proxy):
382 name = proxy.get_name()
383
384 self.indicators[name] = StatusWidget(proxy, self.applet.get_orient(), self.applet.get_size())
385 self.indicator_box.add(self.indicators[name])
386 self.indicators[name].connect("re-sort", self.sort_icons)
389 key = self.make_key(proxy)
390
391 self.indicators[key] = StatusWidget(proxy, self.applet.get_orient(), self.applet.get_size())
392 self.indicator_box.add(self.indicators[key])
393 self.indicators[key].connect("re-sort", self.sort_icons)
387394
388395 self.sort_icons()
389396
390397 def on_icon_removed(self, monitor, proxy):
391 name = proxy.get_name()
392
393 self.indicator_box.remove(self.indicators[name])
394 self.indicators[name].disconnect_by_func(self.sort_icons)
395 del(self.indicators[name])
398 key = self.make_key(proxy)
399
400 self.indicator_box.remove(self.indicators[key])
401 self.indicators[key].disconnect_by_func(self.sort_icons)
402 del(self.indicators[key])
396403
397404 self.sort_icons()
398405