diff options
Diffstat (limited to 'src/service-discovery-applet.in')
-rwxr-xr-x | src/service-discovery-applet.in | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/service-discovery-applet.in b/src/service-discovery-applet.in index 41d9445..4331f73 100755 --- a/src/service-discovery-applet.in +++ b/src/service-discovery-applet.in @@ -145,16 +145,6 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): txts = avahi.txt_array_to_string_array(txt) txts = services.pair_to_dict(txts) services.handle(name, type, host, address, port, txts) -# if os.path.exists("@scriptsdir@/%s.sh" % type): -# cmd = [] -# cmd.append("@scriptsdir@/%s.sh" % type) -# cmd.append("%s" % name) -# cmd.append("%s" % host) -# cmd.append("%s" % address) -# cmd.append("%i" % port) -# cmd.append('%s' % " ".join(avahi.txt_array_to_string_array(txt))) -# print cmd -# pid = subprocess.Popen(cmd).pid def print_error(self, err): print "Error:", str(err) @@ -165,9 +155,12 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): def new_service(self, interface, protocol, name, type, domain): print "Found service '%s' of type '%s' in domain '%s' on %s.%i." % (name, type, domain, self.siocgifname(interface), protocol) - if self.show_local_services == False: - if self.server.IsServiceLocal( interface, protocol, name, type, domain) == True: - return + try: + if self.show_local_services == False: + if self.server.IsServiceLocal( interface, protocol, name, type, domain) == True: + return + except dbus.dbus_bindings.DBusException: + pass if self.zc_types.has_key(type) == False: menuitem = gtk.ImageMenuItem() @@ -200,13 +193,13 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): def remove_service(self, interface, protocol, name, type, domain): print "Service '%s' of type '%s' in domain '%s' on %s.%i disappeared." % (name, type, domain, self.siocgifname(interface), protocol) - if self.show_local_services == False: - # FIXME avahi bug? - if self.server.IsServiceLocal( interface, protocol, name, type, domain) == True: - print "is local" - return - else: - print "is NOT local" + try: + if self.show_local_services == False: + # FIXME avahi bug? + if self.server.IsServiceLocal( interface, protocol, name, type, domain) == True: + return + except dbus.dbus_bindings.DBusException: + pass if self.zc_services.has_key((interface, protocol, name, type, domain)): self.zc_types[type].remove(self.zc_services[(interface, protocol, name, type, domain)]) |