X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-python%2Favahi-discover.in;h=5174b5afab571792f3254f272ac49a6d5ab77c1c;hb=a534996c7f304b219c3c3c41d97f6c20051871f2;hp=00a56023cd1712921648915a7337aa882491ffd1;hpb=ced0d86acf70f435ffdadb794db891be63a5b82a;p=catta diff --git a/avahi-python/avahi-discover.in b/avahi-python/avahi-discover.in index 00a5602..5174b5a 100755 --- a/avahi-python/avahi-discover.in +++ b/avahi-python/avahi-discover.in @@ -43,6 +43,7 @@ service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase() class Main_window(SimpleGladeApp): def __init__(self, path="avahi-discover.glade", root="main_window", domain=None, **kwargs): path = os.path.join(glade_dir, path) + gtk.window_set_default_icon_name("gnome-networktool") SimpleGladeApp.__init__(self, path, root, domain, **kwargs) def on_tree_view_cursor_changed(self, widget, *args): @@ -54,19 +55,24 @@ class Main_window(SimpleGladeApp): #Asynchronous resolving self.server.ResolveService( int(interface), int(protocol), name, stype, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0), reply_handler=self.service_resolved, error_handler=self.print_error) - def protoname(self,protocol): if protocol == avahi.PROTO_INET: return "IPv4" if protocol == avahi.PROTO_INET6: return "IPv6" - + return "n/a" def siocgifname(self, interface): if interface <= 0: - return "any" + return "n/a" else: return self.server.GetNetworkInterfaceNameByIndex(interface) + + def get_interface_name(self, interface, protocol): + if interface == avahi.IF_UNSPEC and protocol == avahi.PROTO_UNSPEC: + return "Wide Area" + else: + return str(self.siocgifname(interface)) + " " + str(self.protoname(protocol)) def service_resolved(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags): print "Service data for service '%s' of type '%s' in domain '%s' on %i.%i:" % (name, stype, domain, interface, protocol) @@ -91,7 +97,10 @@ class Main_window(SimpleGladeApp): def new_service(self, interface, protocol, name, stype, domain, flags): print "Found service '%s' of type '%s' in domain '%s' on %i.%i." % (name, stype, domain, interface, protocol) if self.zc_ifaces.has_key((interface,protocol)) == False: - self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, str(self.siocgifname(interface))+" "+str(self.protoname(protocol)),None,interface,protocol,None,domain) + + ifn = self.get_interface_name(interface, protocol) + + self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, ifn, None,interface,protocol,None,domain) if self.zc_domains.has_key((interface,protocol,domain)) == False: self.zc_domains[(interface,protocol,domain)] = self.insert_row(self.treemodel, self.zc_ifaces[(interface,protocol)], domain,None,interface,protocol,None,domain) if self.zc_types.has_key((interface,protocol,stype,domain)) == False: @@ -102,7 +111,6 @@ class Main_window(SimpleGladeApp): # expand the tree of this path self.tree_view.expand_to_path(self.treemodel.get_path(treeiter)) - def remove_service(self, interface, protocol, name, stype, domain, flags): print "Service '%s' of type '%s' in domain '%s' on %i.%i disappeared." % (name, stype, domain, interface, protocol) self.info_label.set_markup("") @@ -125,7 +133,6 @@ class Main_window(SimpleGladeApp): parent = self.treemodel.iter_parent(treeiter) self.treemodel.remove(treeiter) del self.zc_ifaces[(interface,protocol)] - def new_service_type(self, interface, protocol, stype, domain, flags): global service_browsers @@ -161,7 +168,8 @@ class Main_window(SimpleGladeApp): def new_domain(self,interface, protocol, domain, flags): if self.zc_ifaces.has_key((interface,protocol)) == False: - self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, str(self.siocgifname(interface))+" "+str(self.protoname(protocol)),None,interface,protocol,None,domain) + ifn = self.get_interface_name(interface, protocol) + self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, ifn,None,interface,protocol,None,domain) if self.zc_domains.has_key((interface,protocol,domain)) == False: self.zc_domains[(interface,protocol,domain)] = self.insert_row(self.treemodel, self.zc_ifaces[(interface,protocol)], domain,None,interface,protocol,None,domain) if domain != "local":