From 8b1efca479b11a05be564208e269c889fca6b1f0 Mon Sep 17 00:00:00 2001 From: Andrew Psaltis Date: Sun, 23 Aug 2009 14:08:31 -0400 Subject: [PATCH] Added support for recording dhcp hostnames in wicd-client. --- wicd/netentry.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wicd/netentry.py b/wicd/netentry.py index 7bdf99b..3d2c823 100644 --- a/wicd/netentry.py +++ b/wicd/netentry.py @@ -8,6 +8,7 @@ contained within them. # # Copyright (C) 2008-2009 Adam Blackburn # Copyright (C) 2008-2009 Dan O'Reilly +# Copyright (C) 2009 Andrew Psaltis # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License Version 2 as @@ -73,6 +74,7 @@ class AdvancedSettingsDialog(gtk.Dialog): self.txt_dns_1 = LabelEntry(language['dns'] + ' 1') self.txt_dns_2 = LabelEntry(language['dns'] + ' 2') self.txt_dns_3 = LabelEntry(language['dns'] + ' 3') + self.txt_dhcp_hostname = LabelEntry("DHCP Hostname") self.chkbox_static_ip = gtk.CheckButton(language['use_static_ip']) self.chkbox_static_dns = gtk.CheckButton(language['use_static_dns']) self.chkbox_global_dns = gtk.CheckButton(language['use_global_dns']) @@ -104,6 +106,7 @@ class AdvancedSettingsDialog(gtk.Dialog): self.vbox.pack_start(self.txt_dns_1, fill=False, expand=False) self.vbox.pack_start(self.txt_dns_2, fill=False, expand=False) self.vbox.pack_start(self.txt_dns_3, fill=False, expand=False) + self.vbox.pack_start(self.txt_dhcp_hostname, fill=False, expand=False) self.vbox.pack_end(self.button_hbox, fill=False, expand=False, padding=5) @@ -238,6 +241,7 @@ class AdvancedSettingsDialog(gtk.Dialog): self.set_net_prop("dns1", '') self.set_net_prop("dns2", '') self.set_net_prop("dns3", '') + self.set_net_prop("dhcphostname",noneToString(self.txt_dhcp_hostname.get_text())) class WiredSettingsDialog(AdvancedSettingsDialog): @@ -279,6 +283,12 @@ class WiredSettingsDialog(AdvancedSettingsDialog): self.txt_domain.set_text(self.format_entry("dns_domain")) self.txt_search_dom.set_text(self.format_entry("search_domain")) self.chkbox_global_dns.set_active(bool(wired.GetWiredProperty("use_global_dns"))) + + dhcphname = wired.GetWiredProperty("dhcphostname") + if dhcphname is None: + dhcphname = os.uname()[1] + + self.txt_dhcp_hostname.set_text(dhcphname) self.reset_static_checkboxes() def save_settings(self): @@ -395,6 +405,11 @@ class WirelessSettingsDialog(AdvancedSettingsDialog): self.chkbox_global_settings.set_active(bool(wireless.GetWirelessProperty(networkID, 'use_settings_globally'))) + dhcphname = wireless.GetWirelessProperty(networkID,"dhcphostname") + if dhcphname is None: + dhcphname = os.uname()[1] + self.txt_dhcp_hostname.set_text(dhcphname) + activeID = -1 # Set the menu to this item when we are done user_enctype = wireless.GetWirelessProperty(networkID, "enctype") for x, enc_type in enumerate(self.encrypt_types):