|
|
|
@ -268,6 +268,7 @@ void MainWindow::get_builder(){
|
|
|
|
builder->get_widget("lblHW", lblHW);
|
|
|
|
builder->get_widget("lblHW", lblHW);
|
|
|
|
builder->get_widget("cbHw", cbHw);
|
|
|
|
builder->get_widget("cbHw", cbHw);
|
|
|
|
builder->get_widget("popCalendar", popCalendar);
|
|
|
|
builder->get_widget("popCalendar", popCalendar);
|
|
|
|
|
|
|
|
builder->get_widget("boxDateTime", boxDateTime);
|
|
|
|
this->add_CSS();
|
|
|
|
this->add_CSS();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::gui_exit(){
|
|
|
|
void MainWindow::gui_exit(){
|
|
|
|
@ -318,19 +319,21 @@ void MainWindow::download_local_cfg(){
|
|
|
|
string cmd_get_dhcp = "/usr/bin/ubconfig --source system get network NTPSERVERS";
|
|
|
|
string cmd_get_dhcp = "/usr/bin/ubconfig --source system get network NTPSERVERS";
|
|
|
|
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
|
|
|
|
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
string hw = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
|
|
|
|
string hw = "/usr/bin/ubconfig --source system get clock HWCLOCK_SYNC";
|
|
|
|
this->entry_hardware_clock(hw);
|
|
|
|
string hw_default = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
|
|
|
|
|
|
|
|
this->entry_hardware_clock(hw, hw_default);
|
|
|
|
info_warning_error(0);
|
|
|
|
info_warning_error(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::download_globl_cfg(){
|
|
|
|
void MainWindow::download_globl_cfg(){
|
|
|
|
string cmd_get_dhcp = "/usr/bin/ubconfig --target global get network NTPSERVERS";
|
|
|
|
string cmd_get_dhcp = "/usr/bin/ubconfig --source global get network NTPSERVERS";
|
|
|
|
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
|
|
|
|
string cmd_default_get_dhcp = "/usr/bin/ubconfig --source=default get NTPSERVERS_DEFAULT";
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
|
|
|
|
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE";
|
|
|
|
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE";
|
|
|
|
this->fill_in_reg_zone(cmd);
|
|
|
|
this->fill_in_reg_zone(cmd);
|
|
|
|
string hw = "/usr/bin/ubconfig get clock HWCLOCK_SYNC";
|
|
|
|
string hw = "/usr/bin/ubconfig get clock HWCLOCK_SYNC";
|
|
|
|
this->entry_hardware_clock(hw);
|
|
|
|
string hw_default = "/usr/bin/ubconfig --default get clock HWCLOCK_SYNC";
|
|
|
|
|
|
|
|
this->entry_hardware_clock(hw, hw_default);
|
|
|
|
info_warning_error(1);
|
|
|
|
info_warning_error(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -439,7 +442,7 @@ void MainWindow::hardware_clock_global(string &local, string &etc){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::entry_hardware_clock(string &cmd){
|
|
|
|
void MainWindow::entry_hardware_clock(string &cmd, string &cmd_default){
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
if (obj_result.error == 0){
|
|
|
|
if (obj_result.error == 0){
|
|
|
|
if (obj_result.response == "localtime"){
|
|
|
|
if (obj_result.response == "localtime"){
|
|
|
|
@ -453,6 +456,21 @@ void MainWindow::entry_hardware_clock(string &cmd){
|
|
|
|
warning_info-=1;
|
|
|
|
warning_info-=1;
|
|
|
|
cbHw->set_active(-1);
|
|
|
|
cbHw->set_active(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd_default);
|
|
|
|
|
|
|
|
if (obj_result.error == 0){
|
|
|
|
|
|
|
|
if (obj_result.response == "localtime"){
|
|
|
|
|
|
|
|
cbHw->set_active(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (obj_result.response == "etc"){
|
|
|
|
|
|
|
|
cbHw->set_active(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (obj_result.error == 3){
|
|
|
|
|
|
|
|
warning_info-=1;
|
|
|
|
|
|
|
|
cbHw->set_active(-1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::hardware_clock(){
|
|
|
|
void MainWindow::hardware_clock(){
|
|
|
|
@ -647,12 +665,15 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index==0){
|
|
|
|
else if (activ_index==0){
|
|
|
|
wrapper_system(cmd_default, "&");
|
|
|
|
wrapper_system(cmd_default, "&");
|
|
|
|
|
|
|
|
boxDateTime->set_sensitive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index==1){
|
|
|
|
else if (activ_index==1){
|
|
|
|
wrapper_system(cmd_dhcp, "&");
|
|
|
|
wrapper_system(cmd_dhcp, "&");
|
|
|
|
|
|
|
|
boxDateTime->set_sensitive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index==2){
|
|
|
|
else if (activ_index==2){
|
|
|
|
this->focus_ntp(cmd_set_ntp);
|
|
|
|
this->focus_ntp(cmd_set_ntp);
|
|
|
|
|
|
|
|
boxDateTime->set_sensitive(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index==3){
|
|
|
|
else if (activ_index==3){
|
|
|
|
int start_error = error_info;
|
|
|
|
int start_error = error_info;
|
|
|
|
@ -660,11 +681,13 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove
|
|
|
|
if (start_error != error_info){
|
|
|
|
if (start_error != error_info){
|
|
|
|
error_info=start_error;
|
|
|
|
error_info=start_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
boxDateTime->set_sensitive(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhcp){
|
|
|
|
void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhcp){
|
|
|
|
string cmd = cmd_get_dhcp;
|
|
|
|
string cmd = cmd_get_dhcp;
|
|
|
|
|
|
|
|
boxDateTime->set_sensitive(false);
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
struct Result<string> obj_result = this->wrapper_call(cmd);
|
|
|
|
if (obj_result.error==0){
|
|
|
|
if (obj_result.error==0){
|
|
|
|
string str_dhcp = obj_result.response;
|
|
|
|
string str_dhcp = obj_result.response;
|
|
|
|
@ -715,6 +738,7 @@ void MainWindow::entry_dhcp_mess(string cmd_get_dhcp, string cmd_default_get_dhc
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
btnUpdateDateTime->set_sensitive(true);
|
|
|
|
btnUpdateDateTime->set_sensitive(true);
|
|
|
|
|
|
|
|
boxDateTime->set_sensitive(true);
|
|
|
|
warning_info-=1;
|
|
|
|
warning_info-=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|