From 9dfa1e044da46bb6672018583ccb4fb77d75b004 Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Sat, 21 Jan 2006 00:13:01 +0000 Subject: * use hostname instead of ip if nss-mdns is available git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@86 3be567f1-68ff-0310-b24a-ad7cc433fd2f --- plugins/gnometerminal.py | 4 +++- plugins/nautilus.py | 4 +++- src/service-discovery-applet.in | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/gnometerminal.py b/plugins/gnometerminal.py index d97a320..01fd83f 100644 --- a/plugins/gnometerminal.py +++ b/plugins/gnometerminal.py @@ -95,7 +95,9 @@ class plugin_gnometerminal: return store - def connect(self, name, stype, hostname, address, port, txts): + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + if use_host_names == True: + address = hostname print "connecting using gnometerminal" if txts.has_key("u"): username = self.SshLogin(name, txts["u"]) diff --git a/plugins/nautilus.py b/plugins/nautilus.py index e208a8c..4cf82a2 100644 --- a/plugins/nautilus.py +++ b/plugins/nautilus.py @@ -22,7 +22,9 @@ class plugin_nautilus: self.author = "Sébastien Estienne" self.description = "Accessing zeroconf services using Nautilus" - def connect(self, name, stype, hostname, address, port, txts): + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + if use_host_names == True: + address = hostname print "connecting using nautilus" path = get_txt_value(txts,"path") username = get_txt_value(txts,"u") diff --git a/src/service-discovery-applet.in b/src/service-discovery-applet.in index 0ff8691..295ce5d 100755 --- a/src/service-discovery-applet.in +++ b/src/service-discovery-applet.in @@ -254,6 +254,10 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): self.server = dbus.Interface(self.system_bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER) + try: + self.use_host_names = self.server.IsNSSSupportAvailable() + except: + self.use_host_names = False self.sdaNotifications = Notifications(self) @@ -286,7 +290,7 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): txts = avahi.txt_array_to_string_array(txt) txts = sdapplet.pluginutils.pair_to_dict(txts) - self.plugin.plugins[type][0].connect(name, type, host, address, port, txts) + self.plugin.plugins[type][0].connect(self.use_host_names, name, type, host, address, port, txts) def print_error(self, err): # FIXME we should use notifications @@ -317,7 +321,7 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet): return except dbus.dbus_bindings.DBusException: pass - + # if we found a service, remove "No service found" if self.zc_types == {}: for menuitem in self.service_menu.get_children(): -- cgit