|
|
|
@ -97,7 +97,6 @@ void MainWindow::settings() {
|
|
|
|
this->event();
|
|
|
|
this->event();
|
|
|
|
imgInfo->set("/usr/share/ubl-settings-datetime/images/checked.svg");
|
|
|
|
imgInfo->set("/usr/share/ubl-settings-datetime/images/checked.svg");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -139,7 +138,6 @@ void MainWindow::lacalization() {
|
|
|
|
lblHW->set_text(_("Synchronize hardware time:"));
|
|
|
|
lblHW->set_text(_("Synchronize hardware time:"));
|
|
|
|
cbHw->append(_("Local time"));
|
|
|
|
cbHw->append(_("Local time"));
|
|
|
|
cbHw->append(_("UTC time"));
|
|
|
|
cbHw->append(_("UTC time"));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::flag_block_gui() {
|
|
|
|
void MainWindow::flag_block_gui() {
|
|
|
|
@ -187,36 +185,20 @@ void MainWindow::add_CSS() {
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
|
|
|
|
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();//get default screen
|
|
|
|
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();//get default screen
|
|
|
|
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
|
|
|
|
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context = boxColor->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> boxColor_css = boxColor->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblHead->get_style_context();
|
|
|
|
boxColor_css->add_class("cssboxColor1");
|
|
|
|
context->add_class("cssboxColor1");
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> lblHead_css = lblHead->get_style_context();
|
|
|
|
context_lbl_head->add_class("textHead");
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> boxButton_css = boxButton->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> boxButton_css = boxButton->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> boxSave_css = boxSave->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> boxSave_css = boxSave->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> btnDownload_css = btnDownload->get_style_context();
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> lblDownload_css = lblDownload->get_style_context();
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> imgDonwload_css = imgDonwload->get_style_context();
|
|
|
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> headerBar_css = headerBar->get_style_context();
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> headerBar_css = headerBar->get_style_context();
|
|
|
|
headerBar_css->add_class("bkim");
|
|
|
|
lblHead_css->add_class("textHead");
|
|
|
|
imgDonwload_css->add_class("bkim");
|
|
|
|
boxButton_css->add_class("bkimButton");
|
|
|
|
lblDownload_css->add_class("bkim");
|
|
|
|
boxSave_css->add_class("bkimButton");
|
|
|
|
btnDownload_css->add_class("bkim");
|
|
|
|
headerBar_css->add_class("bkimHeadBar");
|
|
|
|
boxButton_css->add_class("bkim");
|
|
|
|
//Glib::RefPtr<Gtk::StyleContext> w = this->get_style_context();
|
|
|
|
boxSave_css->add_class("bkim");
|
|
|
|
//w->add_class("bkim");
|
|
|
|
double opacity= 1.0;
|
|
|
|
|
|
|
|
headerBar->set_opacity(opacity);
|
|
|
|
|
|
|
|
boxButton->set_opacity(opacity);
|
|
|
|
|
|
|
|
boxSave->set_opacity(opacity);
|
|
|
|
|
|
|
|
btnDownload->set_opacity(opacity);
|
|
|
|
|
|
|
|
lblDownload->set_opacity(opacity);
|
|
|
|
|
|
|
|
imgDonwload->set_opacity(opacity);
|
|
|
|
|
|
|
|
btnSave->set_opacity(opacity);
|
|
|
|
|
|
|
|
lblSave->set_opacity(opacity);
|
|
|
|
|
|
|
|
btnSettings->set_opacity(opacity);
|
|
|
|
|
|
|
|
imgSave->set_opacity(opacity);
|
|
|
|
|
|
|
|
imgSettings->set_opacity(opacity);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -290,7 +272,6 @@ void MainWindow::get_builder() {
|
|
|
|
builder->get_widget("imgDonwload", imgDonwload);
|
|
|
|
builder->get_widget("imgDonwload", imgDonwload);
|
|
|
|
builder->get_widget("imgSettings", imgSettings);
|
|
|
|
builder->get_widget("imgSettings", imgSettings);
|
|
|
|
builder->get_widget("imgSave", imgSave);
|
|
|
|
builder->get_widget("imgSave", imgSave);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::gui_exit() {
|
|
|
|
void MainWindow::gui_exit() {
|
|
|
|
@ -322,7 +303,6 @@ void MainWindow::event() {
|
|
|
|
btnSaveLocalGlob->signal_activate().connect([&]() {save_global_local_cfg();});
|
|
|
|
btnSaveLocalGlob->signal_activate().connect([&]() {save_global_local_cfg();});
|
|
|
|
btnSaveLocal->signal_activate().connect([&]() {save_local_cfg();});
|
|
|
|
btnSaveLocal->signal_activate().connect([&]() {save_local_cfg();});
|
|
|
|
btnSaveGlob->signal_activate().connect([&]() {save_global_cfg();});
|
|
|
|
btnSaveGlob->signal_activate().connect([&]() {save_global_cfg();});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::synopsis_show() {
|
|
|
|
void MainWindow::synopsis_show() {
|
|
|
|
@ -366,8 +346,8 @@ void MainWindow::save_local_cfg() {
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
|
|
|
|
string remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
|
|
|
|
string remove_ntp = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
string local = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
string local = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=localtime";
|
|
|
|
string hw = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
string hw = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=utc";
|
|
|
|
this->hardware_clock_global(local, hw);
|
|
|
|
this->hardware_clock_global(local, hw);
|
|
|
|
@ -380,8 +360,8 @@ void MainWindow::save_global_cfg() {
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
string cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_dhcp = "/usr/bin/ubconfig --target global set network NTPSERVERS=dhcp";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
|
|
|
|
string remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
|
|
|
|
string remove_ntp = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
|
|
|
|
this->save_Dhcp(cmd_default, cmd_dhcp, remove_ntp, cmd_set_ntp);
|
|
|
|
string local = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
string local = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=localtime";
|
|
|
|
string hw = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
string hw = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=utc";
|
|
|
|
this->hardware_clock_global(local, hw);
|
|
|
|
this->hardware_clock_global(local, hw);
|
|
|
|
@ -560,7 +540,6 @@ bool MainWindow::focus_ntp(string &cmd_set_ntp) {
|
|
|
|
mess_dchp->show();
|
|
|
|
mess_dchp->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -676,8 +655,6 @@ void MainWindow::event_entry_cbDhcp() {
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
txtNtpServer->set_text("");
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
txtNtpServer->set_sensitive(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index == 1) {
|
|
|
|
else if (activ_index == 1) {
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
btnUpdateDateTime->set_sensitive(false);
|
|
|
|
@ -703,7 +680,6 @@ 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, "&");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (activ_index == 1) {
|
|
|
|
else if (activ_index == 1) {
|
|
|
|
wrapper_system(cmd_dhcp, "&");
|
|
|
|
wrapper_system(cmd_dhcp, "&");
|
|
|
|
@ -846,8 +822,6 @@ void MainWindow::fill_in_reg_zone(string &cmd) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_config() {
|
|
|
|
void MainWindow::get_config() {
|
|
|
|
this->read_file();
|
|
|
|
this->read_file();
|
|
|
|
this->update_hour_minute();
|
|
|
|
this->update_hour_minute();
|
|
|
|
@ -872,7 +846,6 @@ array<string, 2> MainWindow::split_region_zone(string &read_reg_zon_cfg) {
|
|
|
|
arr[1] = "";
|
|
|
|
arr[1] = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return arr;
|
|
|
|
return arr;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1009,7 +982,6 @@ string MainWindow::call(string cmd) {
|
|
|
|
if (status == -1) {
|
|
|
|
if (status == -1) {
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return path;
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1227,7 +1199,8 @@ void MainWindow::sort_zone(vector<string> *time_reg_map_local,vector<string> *ti
|
|
|
|
b = (*time_reg_map)[j];
|
|
|
|
b = (*time_reg_map)[j];
|
|
|
|
(*time_reg_map)[j] = (*time_reg_map)[j + 1];
|
|
|
|
(*time_reg_map)[j] = (*time_reg_map)[j + 1];
|
|
|
|
(*time_reg_map)[j + 1] = b;
|
|
|
|
(*time_reg_map)[j + 1] = b;
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|