def __init__(self, dbus_ifaces):
     """ Load the wired network entry. """
     NetworkEntry.__init__(self, dbus_ifaces)
     self.image.set_alignment(.5, 0)
     self.image.set_size_request(60, -1)
     self.image.set_from_icon_name("network-wired", 6)
     self.image.show()
     self.expander.show()
     self.connect_button.show()
     self.expander.set_label(language['wired_network'])
     self.is_full_gui = True
     self.button_add = gtk.Button(stock=gtk.STOCK_ADD)
     self.button_delete = gtk.Button(stock=gtk.STOCK_DELETE)
     self.profile_help = gtk.Label(language['wired_network_instructions'])
     self.chkbox_default_profile = gtk.CheckButton(language['default_wired'])
     self.combo_profile_names = gtk.combo_box_entry_new_text()
     self.profile_list = wired.GetWiredProfileList()
     if self.profile_list:
         for x in self.profile_list:
             self.combo_profile_names.append_text(x)
     self.profile_help.set_justify(gtk.JUSTIFY_LEFT)
     self.profile_help.set_line_wrap(True)
     self.hbox_temp = gtk.HBox(False, 0)
     self.hbox_def = gtk.HBox(False, 0)
     self.vbox_top.pack_start(self.profile_help, True, True)
     self.vbox_top.pack_start(self.hbox_def)
     self.vbox_top.pack_start(self.hbox_temp)
     self.hbox_temp.pack_start(self.combo_profile_names, True, True)
     self.hbox_temp.pack_start(self.button_add, False, False)
     self.hbox_temp.pack_start(self.button_delete, False, False)
     self.hbox_def.pack_start(self.chkbox_default_profile, False, False)
     self.button_add.connect("clicked", self.add_profile)
     self.button_delete.connect("clicked", self.remove_profile)
     self.chkbox_default_profile.connect("toggled",
                                         self.toggle_default_profile)
     self.combo_profile_names.connect("changed", self.change_profile)
     self.script_button.connect("button-press-event", self.edit_scripts)
     if stringToBoolean(wired.GetWiredProperty("default")):
         self.chkbox_default_profile.set_active(True)
     else:
         self.chkbox_default_profile.set_active(False)
     self.show_all()
     self.profile_help.hide()
     self.advanced_dialog = WiredSettingsDialog(self.combo_profile_names.get_active_text())
     if self.profile_list is not None:
         prof = wired.GetDefaultWiredNetwork()
         if prof != None:  
             i = 0
             while self.combo_profile_names.get_active_text() != prof:
                 self.combo_profile_names.set_active(i)
                 i += 1
         else:
             self.combo_profile_names.set_active(0)
         self.expander.set_expanded(False)
     else:
         if not wired.GetAlwaysShowWiredInterface():
             self.expander.set_expanded(True)
         self.profile_help.show()        
     self.check_enable()
     self.wireddis = self.connect("destroy", self.destroy_called)
 def __init__(self, networkID, dbus_ifaces):
     """ Build the wireless network entry. """
     NetworkEntry.__init__(self, dbus_ifaces)
     self.networkID = networkID
     self.image.set_padding(0, 0)
     self.image.set_alignment(.5, 0)
     self.image.set_size_request(60, -1)
     self.image.set_from_icon_name("network-wired", 6)
     self.essid = wireless.GetWirelessProperty(networkID, "essid")
     print "ESSID : " + self.essid
     self.lbl_strength = GreyLabel()
     self.lbl_encryption = GreyLabel()
     self.lbl_mac = GreyLabel()
     self.lbl_channel = GreyLabel()
     self.lbl_mode = GreyLabel()
     self.hbox_status = gtk.HBox(False, 5)
     self.chkbox_autoconnect = gtk.CheckButton(language['automatic_connect'])
     self.set_signal_strength(wireless.GetWirelessProperty(networkID,
                                                           'quality'),
                              wireless.GetWirelessProperty(networkID,
                                                           'strength'))
     self.set_mac_address(wireless.GetWirelessProperty(networkID, 'bssid'))
     self.set_mode(wireless.GetWirelessProperty(networkID, 'mode'))
     self.set_channel(wireless.GetWirelessProperty(networkID, 'channel'))
     self.set_encryption(wireless.GetWirelessProperty(networkID,
                                                      'encryption'),
                         wireless.GetWirelessProperty(networkID,
                                                     'encryption_method'))
     self.expander.set_use_markup(True)
     self.expander.set_label(self._escape(self.essid) + "   " +
                             self.lbl_strength.get_label() + "   " +
                             self.lbl_encryption.get_label() + "   " +
                             self.lbl_mac.get_label())
     self.hbox_status.pack_start(self.lbl_strength, True, True)
     self.hbox_status.pack_start(self.lbl_encryption, True, True)
     self.hbox_status.pack_start(self.lbl_mac, True, True)
     self.hbox_status.pack_start(self.lbl_mode, True, True)
     self.hbox_status.pack_start(self.lbl_channel, True, True)
     self.vbox_top.pack_start(self.chkbox_autoconnect, False, False)
     self.vbox_top.pack_start(self.hbox_status, True, True)
     if stringToBoolean(self.format_entry(networkID, "automatic")):
         self.chkbox_autoconnect.set_active(True)
     else:
         self.chkbox_autoconnect.set_active(False)
     self.chkbox_autoconnect.connect("toggled", self.update_autoconnect)
     self.script_button.connect("button-press-event", self.edit_scripts)
     self.show_all()
     self.advanced_dialog = WirelessSettingsDialog(networkID)
     self.wifides = self.connect("destroy", self.destroy_called)
 def change_profile(self, widget):
     """ Called when a new profile is chosen from the list. """
     if self.combo_profile_names.get_active() > -1:
         if not self.is_full_gui:
             return
         profile_name = self.combo_profile_names.get_active_text()
         wired.ReadWiredNetworkProfile(profile_name)
         self.advanced_dialog.txt_ip.set_text(self.format_entry("ip"))
         self.advanced_dialog.txt_netmask.set_text(self.format_entry("netmask"))
         self.advanced_dialog.txt_gateway.set_text(self.format_entry("gateway"))
         self.advanced_dialog.txt_dns_1.set_text(self.format_entry("dns1"))
         self.advanced_dialog.txt_dns_2.set_text(self.format_entry("dns2"))
         self.advanced_dialog.txt_dns_3.set_text(self.format_entry("dns3"))
         self.advanced_dialog.prof_name = profile_name
         is_default = wired.GetWiredProperty("default")
         self.chkbox_default_profile.set_active(stringToBoolean(is_default))