From 06bee15e03652f97fa6703a69b9a3f6c1a7fb008 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Fri, 3 Feb 2023 11:17:04 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D0=B2=D1=8B=D0=B1=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=20=D0=B2=20'=D1=80=D1=83=D1=87=D0=BD=D1=83=D1=8E'?= =?UTF-8?q?=20=D0=B2=20Comboboxtext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-datetime.cc | 19 +++++++++++++------ source/ubl-settings-datetime.h | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) 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();