diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 80aca74..38eac1a 100644 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -258,7 +258,7 @@ void MainWindow::event(){ cbxSynchronizeNtpGlob->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::set_ntp_toggle_glob)); btnUpdateDateTime->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::wrapper_update_time_date)); btnChooseDate->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::calendar_show)); - cbDhcp->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::event_entrycbDhcp)); + cbDhcp->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::event_entry_cbDhcp)); cbRegion->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone)); cbRegionGlob->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone_glob)); cbZone->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::enter_zone)); @@ -305,7 +305,7 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){ return true; } -void MainWindow::event_entrycbDhcp(){ +void MainWindow::event_entry_cbDhcp(){ Glib::ustring str_dhcp = cbDhcp->get_active_text(); int activ_index = cbDhcp->get_active_row_number(); cout << activ_index << endl; @@ -325,14 +325,14 @@ void MainWindow::event_entrycbDhcp(){ txtNtpServer->set_text(""); } else if (activ_index==2){ + txtNtpServer->set_sensitive(true); string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); - if ((str_dhcp!="") && (str_dhcp!="(null)") ){ + if ((str_dhcp!="") && (str_dhcp!="(null)") && (str_dhcp!="default")){ str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length()); str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n")); if (str_dhcp!="dhcp" && str_dhcp!="(null)"){ txtNtpServer->set_text(str_dhcp); } - txtNtpServer->set_sensitive(true); cbDhcp->set_active(activ_index); } } @@ -386,11 +386,18 @@ void MainWindow::calendar_show(){ void MainWindow::enry_dhcp_mess(){ string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); if ((str_dhcp!="") && (str_dhcp!="(null)")){ + this->set_ntp_toggle_glob(); cbxSynchronizeNtpGlob->set_active(1); str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length()); str_dhcp = str_dhcp.substr(0,str_dhcp.find("\n")); if (str_dhcp=="dhcp"){ + cbDhcp->set_active(1); + txtNtpServer->set_text(""); + txtNtpServer->set_sensitive(false); + } + else if (str_dhcp=="default"){ cbDhcp->set_active(0); + txtNtpServer->set_text(""); txtNtpServer->set_sensitive(false); } else{ @@ -403,11 +410,11 @@ void MainWindow::enry_dhcp_mess(){ txtNtpServer->set_text(""); } else{ - cbDhcp->set_active(1); + cbDhcp->set_active(2); txtNtpServer->set_text(str_dhcp); + txtNtpServer->set_sensitive(true); } } - this->set_ntp_toggle_glob(); } else{ cbxSynchronizeNtpGlob->set_active(0); diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index a7f566f..e8b202c 100644 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -56,7 +56,7 @@ class MainWindow : public Gtk::ApplicationWindow { void event(); void gui_mess_close(); bool focus_ntp(GdkEventFocus* event); - void event_entrycbDhcp(); + void event_entry_cbDhcp(); void get_calendar(); void calendar_show(); void enry_dhcp_mess();