diff --git a/#ubl-settings-datetime.glade#~ b/#ubl-settings-datetime.glade#~
deleted file mode 100644
index 720e5a8..0000000
--- a/#ubl-settings-datetime.glade#~
+++ /dev/null
@@ -1,1398 +0,0 @@
-
-
-
-
-
-
- 730
- 530
- False
- center
- ubconfig-gui
- south-west
-
-
-
-
-
-
-
-
- False
- Внимание!
- dialog
-
-
- True
- False
- vertical
-
-
- True
- False
- 5
- 5
- 5
- 5
-
-
- True
- False
- 5
- 5
- 5
- 6
- 6
- 50
- gtk-dialog-warning
-
-
- True
- True
- 0
-
-
-
-
- 160
- True
- False
- start
- center
- 6
- 6
- Enter DHCP !
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 1
-
-
-
-
- OK
- True
- True
- True
- 5
- 5
- 5
- 5
- 3
- 3
-
-
- False
- True
- 1
-
-
-
-
-
-
- False
- Внимание!
- center
- dialog
-
-
- True
- False
- vertical
-
-
- True
- False
- 5
- 5
- 5
- 5
-
-
- True
- False
- 5
- 5
- 5
- 6
- 6
- 50
- gtk-dialog-warning
-
-
- True
- True
- 0
-
-
-
-
- 160
- True
- False
- start
- center
- 5
- 5
- 5
- 5
- 6
- 6
- Enter DHCP !
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 1
-
-
-
-
- OK
- True
- True
- True
- 5
- 5
- 5
- 5
- 3
- 3
-
-
- False
- True
- 1
-
-
-
-
-
-
- False
-
-
- True
- False
- 0
- none
-
-
- True
- False
- 5
- 5
- 5
- 5
-
-
- True
- False
- vertical
-
-
- True
- True
- True
- Synopsis
-
-
- False
- True
- 2
-
-
-
-
- True
- True
- True
- About the program
-
-
- False
- True
- 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
-
-
- True
- False
- vertical
-
-
- True
- False
- vertical
-
-
- True
- False
-
-
- True
- False
- 5
- 5
- 5
- 5
- 6
- 6
- gtk-missing-image
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- start
- 5
- 5
- 5
- 5
- 6
- 6
-
-
-
-
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- vertical
-
-
- True
- False
-
-
- 90
- True
- False
- 5
- 5
- 5
- 5
- 6
- 6
- 69
- ubl-settings-datetime
-
-
- False
- True
- 0
-
-
-
-
- True
- False
-
-
- True
- False
-
-
- True
- False
- vertical
-
-
- 255
- True
- False
- Date and time settings
-
-
-
-
-
-
-
-
- True
- True
- 0
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- True
- 0
-
-
-
-
- True
- False
-
-
- False
- True
- 1
-
-
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 0
-
-
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- vertical
-
-
- True
- False
- vertical
-
-
- True
- False
- 5
- 5
- 5
- 5
- 0.019999999552965164
- in
-
-
- True
- False
- 5
- 5
- 5
- vertical
-
-
- True
- False
-
-
- 0
- True
- False
- 5
- 5
- 5
- 5
- 6
- 6
- Time
- True
- 0
-
-
- False
- True
- 0
-
-
-
-
- True
- True
- 5
- 5
- 5
- 5
- 6
- 6
- 2
- 0.099999999776482579
- True
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- :
-
-
- False
- True
- 2
-
-
-
-
- True
- True
- 5
- 5
- 5
- 5
- 6
- 6
- 2
- True
-
-
- False
- True
- 3
-
-
-
-
- 20
- True
- False
- 5
- 5
- 5
- 5
- 6
- 6
- Date
- True
- 0
-
-
- False
- True
- 4
-
-
-
-
- -1
- True
- True
- Date
-Format: DD.MM.YYYY
- 5
- 5
- 5
- 5
- 6
- 6
-
-
- True
- True
- 5
-
-
-
-
- True
- True
- True
- Интерактивный выбор даты
- 5
- 10
- 5
- 10
- 6
- 6
-
-
- True
- False
- x-office-calendar
-
-
-
-
- False
- True
- 6
-
-
-
-
- False
- True
- 1
-
-
-
-
- True
- False
-
-
- True
- True
- True
- 7
- 5
- 7
- 5
- 6
- 6
-
-
- True
- False
- center
- center
-
-
- True
- False
- 5
- 5
- 5
- 5
- media-playlist-repeat
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- center
- center
- Sync by
-
-
- False
- True
- 1
-
-
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
-
-
- False
- True
- 1
-
-
-
-
- True
- False
-
-
- False
- True
- 2
-
-
-
-
- True
- True
- True
- 5
- 10
- 5
- 10
- 6
- 6
-
-
- True
- False
- center
- center
- Synchronize hardware time
-
-
-
-
- True
- True
- 3
-
-
-
-
- False
- True
- 3
-
-
-
-
-
-
- True
- False
- Current date and time
-
-
-
-
- False
- True
- 0
-
-
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- vertical
-
-
- True
- False
- 5
- 5
- 5
- 5
- 0.019999999552965164
- in
-
-
- True
- False
- 5
- 5
- 5
- vertical
-
-
- True
- False
-
-
- True
- False
- 5
- 5
- 5
- 5
- 6
- 6
-
-
- False
- True
- 1
-
-
-
-
- -1
- True
- True
- Enter the name of the ntp server or its ip address. When entering multiple addresses, separate them with spaces.
- center
- 5
- 10
- 5
- 10
- 6
- 6
-
-
- True
- True
- 3
-
-
-
-
- False
- True
- 1
-
-
-
-
-
-
- True
- False
- Synchronize via NTP:
-
-
-
-
- False
- True
- 0
-
-
-
-
- False
- True
- 2
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- 5
- 0.019999999552965164
- in
-
-
- True
- False
-
-
- True
- False
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- 8
- 5
- 8
- 5
- 6
- 13
- Region
- 0
-
-
- False
- True
- 2
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- 6
- 10
- False
- False
-
-
- False
- True
- 3
-
-
-
-
- True
- False
- 10
- 5
- 10
- 5
- 6
- 13
- Area
- 0
-
-
- False
- True
- 4
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- 6
- 10
- False
- False
-
-
- False
- True
- 5
-
-
-
-
- 5
- True
- False
-
-
- False
- True
- 6
-
-
-
-
- True
- False
-
-
- False
- True
- 7
-
-
-
-
-
-
- True
- False
- Time Zone
-
-
-
-
- False
- True
- 3
-
-
-
-
- False
- True
- 2
-
-
-
-
- False
- True
- 0
-
-
-
-
-
-
-
-
-
- 240
- 185
- False
- btnChooseDate
- bottom
- none
-
-
- True
- True
- 10
- 10
- 10
- 10
- 10
- 10
- 2023
- 1
- 10
-
-
-
-
diff --git a/screenshot/screenshot.png b/screenshot/screenshot.png
index daf786e..17e3a47 100755
Binary files a/screenshot/screenshot.png and b/screenshot/screenshot.png differ
diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc
index 3cbf79e..3639da0 100755
--- a/source/ubl-settings-datetime.cc
+++ b/source/ubl-settings-datetime.cc
@@ -152,6 +152,10 @@ void MainWindow::lacalization(){
mess_sudo->set_title(_("Warning!"));
mess_dchp->set_title(_("Warning!"));
lblTimeBios->set_text(_("Synchronize hardware time"));
+ lblHW->set_text(_("Synchronize hardware time:"));
+ cbHw->append(_("Local time"));
+ cbHw->append(_("UTC time"));
+
}
void MainWindow::flag_block_gui(){
@@ -266,6 +270,8 @@ void MainWindow::get_builder(){
builder->get_widget("btnSaveGlob", btnSaveGlob);
builder->get_widget("headerBar", headerBar);
builder->get_widget("lblHeader", lblHeader);
+ builder->get_widget("lblHW", lblHW);
+ builder->get_widget("cbHw", cbHw);
this->add_CSS();
}
void MainWindow::gui_exit(){
@@ -299,11 +305,13 @@ void MainWindow::event(){
btnSaveLocalGlob->signal_clicked().connect([&](){save_global_local_cfg();});
btnSaveLocal->signal_clicked().connect([&](){save_local_cfg();});
btnSaveGlob->signal_clicked().connect([&](){save_global_cfg();});
+
}
void MainWindow::synopsis_show(){
int start_error = error_info;
- //wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home");
+ wrapper_system("xdg-open https://wiki.ublinux.ru/ru/home &");
+ //gtk_show_uri_on_window(NULL, "https://wiki.ublinux.ru/ru/home", 0, 0);
if (start_error!=error_info){
error_info=start_error;
}
@@ -317,6 +325,8 @@ void MainWindow::download_local_cfg(){
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";
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
+ string hw = "/usr/bin/ubconfig --default --source system get clock HWCLOCK_SYNC";
+ this->entry_hardware_clock(hw);
info_warning_error(0);
}
@@ -326,17 +336,22 @@ void MainWindow::download_globl_cfg(){
this->entry_dhcp_mess(cmd_get_dhcp, cmd_default_get_dhcp);
string cmd = "/usr/bin/ubconfig --default --source global get clock ZONE";
this->fill_in_reg_zone(cmd);
+ string hw = "/usr/bin/ubconfig --default --source global get clock HWCLOCK_SYNC";
+ this->entry_hardware_clock(hw);
info_warning_error(1);
}
void MainWindow::save_local_cfg(){
- string cmd = "ubconfig --target system set clock ZONE=";
+ string cmd = "/usr/bin/ubconfig --target system set clock ZONE=";
this->enter_zone(cmd);
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_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
string remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
+ string local = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=localtime";
+ string hw = "/usr/bin/ubconfig --target system set clock HWCLOCK_SYNC=utc";
+ this->hardware_clock_global(local, hw);
info_warning_error(2);
}
@@ -348,6 +363,9 @@ void MainWindow::save_global_cfg(){
string cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
string remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
+ string local = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=localtime";
+ string hw = "/usr/bin/ubconfig --target global set clock HWCLOCK_SYNC=utc";
+ this->hardware_clock_global(local, hw);
info_warning_error(3);
}
void MainWindow::save_global_local_cfg(){
@@ -357,22 +375,11 @@ void MainWindow::save_global_local_cfg(){
string cmd_set_ntp = "";
string remove = "";
if (flag_save_global==false){
- cmd = "/usr/bin/ubconfig --target global set clock ZONE=";
- this->enter_zone(cmd);
- cmd_default = "/usr/bin/ubconfig --target global set network NTPSERVERS=default";
- cmd_dhcp = "/usr/bin/ubconfig --target global set network NTPSERVERS=dhcp";
- cmd_set_ntp = "/usr/bin/ubconfig --target global set network NTPSERVERS=\"";
- remove = "/usr/bin/ubconfig --target global remove network NTPSERVERS";
- this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
+ this->save_local_cfg();
+
}
if (flag_save_local==false){
- cmd = "ubconfig --target system set clock ZONE=";
- this->enter_zone(cmd);
- cmd_default = "/usr/bin/ubconfig --target system set network NTPSERVERS=default";
- cmd_dhcp = "/usr/bin/ubconfig --target system set network NTPSERVERS=dhcp";
- cmd_set_ntp = "/usr/bin/ubconfig --target system set network NTPSERVERS=\"";
- remove = "/usr/bin/ubconfig --target system remove network NTPSERVERS";
- this->save_Dhcp(cmd_default, cmd_dhcp, remove, cmd_set_ntp);
+ this->save_global_cfg();
}
info_warning_error(4);
}
@@ -429,6 +436,31 @@ void MainWindow::wrapper_system(string cmd){
}
+void MainWindow::hardware_clock_global(string &local, string &utc){
+ int index = cbHw->get_active_row_number();
+ cout << index << endl;
+ if (index == 0){
+ cout << local << endl;
+ wrapper_system(local);
+ }
+ else if (index == 1){
+ cout << utc << endl;
+ wrapper_system(utc);
+ }
+}
+
+void MainWindow::entry_hardware_clock(string &cmd){
+ struct Result obj_result = this->wrapper_call(cmd);
+ if (obj_result.error == 0){
+ if (obj_result.response == "localtime"){
+ cbHw->set_active(0);
+ }
+ else{
+ cbHw->set_active(1);
+ }
+ }
+}
+
void MainWindow::hardware_clock(){
string cmd = "hwclock --systohc";
wrapper_system(cmd);
diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h
index 9859a5a..2069e94 100755
--- a/source/ubl-settings-datetime.h
+++ b/source/ubl-settings-datetime.h
@@ -106,6 +106,8 @@ class MainWindow : public Gtk::ApplicationWindow {
Gtk::ModelButton *btnSynopsis;
Gtk::HeaderBar *headerBar;
Gtk::Label *lblHeader;
+ Gtk::Label *lblHW;
+ Gtk::ComboBoxText *cbHw;
unsigned int year=0;
unsigned int month=0;
unsigned int day=0;
@@ -128,8 +130,10 @@ class MainWindow : public Gtk::ApplicationWindow {
MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder);
MainWindow(Glib::RefPtr const& builder);
virtual ~MainWindow() = default;
+ void hardware_clock_global(string &local, string &utc);
void info_warning_error(int mess);
void synopsis_show();
+ void entry_hardware_clock(string &cmd);
void save_global_local_cfg();
void fill_in_reg_zone(string &cmd);
void download_globl_cfg();
diff --git a/source/ubl-util-standard.c b/source/ubl-util-standard.c
index 8d7e9ee..8cff122 100644
--- a/source/ubl-util-standard.c
+++ b/source/ubl-util-standard.c
@@ -65,6 +65,5 @@ inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, in
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
gtk_widget_show(GTK_WIDGET(plug));
}
- return;
}
#endif
\ No newline at end of file
diff --git a/source/ubl-util-standard.h b/source/ubl-util-standard.h
index 4c1ae22..3209625 100644
--- a/source/ubl-util-standard.h
+++ b/source/ubl-util-standard.h
@@ -1,5 +1,3 @@
-#define STANDARD_PATH "/usr/share/ubl-util-standard/ubl-util-standard.glade"
-#define CSS_PATH "/usr/share/ubl-util-standard/ubl-util-standard.css"
#ifndef __cplusplus
#include
#include
diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade
index 9012e06..10068ec 100644
--- a/ubl-settings-datetime.glade
+++ b/ubl-settings-datetime.glade
@@ -996,114 +996,175 @@ Format: DD.MM.YYYY
True
False
+ vertical
-
- True
- False
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- 8
- 5
- 8
- 5
- 6
- 13
- Region
- 0
-
-
- False
- True
- 2
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- 6
- 10
- False
- False
-
-
- False
- True
- 3
-
-
-
-
- True
- False
- 10
- 5
- 10
- 5
- 6
- 13
- Area
- 0
-
-
- False
- True
- 4
-
-
-
-
- True
- False
- 5
- 5
- 5
- 5
- 6
- 10
- False
- False
-
-
- False
- True
- 5
-
-
-
-
- 5
+
True
False
+
+
+ True
+ False
+ start
+ 8
+ 31
+ 8
+ 31
+ 6
+ 13
+ Synchronize hardware time:
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ 5
+ 5
+ 5
+ 5
+ 6
+ 10
+ False
+ False
+
+
+ False
+ True
+ 1
+
+
False
True
- 6
+ 0
-
+
True
False
+
+
+ True
+ False
+
+
+ False
+ True
+ 1
+
+
+
+
+ True
+ False
+ 8
+ 5
+ 8
+ 5
+ 6
+ 6
+ Region
+ 0
+
+
+ False
+ True
+ 2
+
+
+
+
+ True
+ False
+ 5
+ 5
+ 5
+ 5
+ 6
+ 10
+ False
+ False
+
+
+ False
+ True
+ 3
+
+
+
+
+ True
+ False
+ 10
+ 5
+ 10
+ 5
+ 6
+ 13
+ Area
+ 0
+
+
+ False
+ True
+ 4
+
+
+
+
+ True
+ False
+ 5
+ 5
+ 5
+ 5
+ 6
+ 10
+ False
+ False
+
+
+ False
+ True
+ 5
+
+
+
+
+ 5
+ True
+ False
+
+
+ False
+ True
+ 6
+
+
+
+
+ True
+ False
+
+
+ False
+ True
+ 7
+
+
False
True
- 7
+ 1
@@ -1152,6 +1213,7 @@ Format: DD.MM.YYYY
5
5
2
+ False
ubl-settings-datetime
@@ -1166,8 +1228,6 @@ Format: DD.MM.YYYY
5
5
5
- 6
- 6
32
ubl-settings-datetime
@@ -1197,8 +1257,6 @@ Format: DD.MM.YYYY
5
5
5
- 6
- 6
Download
@@ -1267,8 +1325,6 @@ Format: DD.MM.YYYY
5
5
5
- 6
- 6
Save