diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 9ea6713..7309f7a 100644 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -114,6 +114,7 @@ void MainWindow::lacalization(){ _txtDate->set_tooltip_text(gettext("Date of\nFormat: DD.MM.YYYY")); _lblSynchronizebChkGLob->set_text(gettext("Synchronize via NTP")); + _cbDhcp->append(gettext("By default")); _cbDhcp->append(gettext("DHCP")); _cbDhcp->append(gettext("Manually")); _lblDateTimeSetting->set_text(gettext("Local Configuration")); @@ -228,7 +229,11 @@ void MainWindow::get_builder(){ builder->get_widget("mess_sudo",_mess_sudo); builder->get_widget("lblMessageSudo",_lblMessageSudo); builder->get_widget("btnMessCloseSudo",_btnMessCloseSudo); - + builder->get_widget("windowsNnpClose",_windowsNnpClose); + builder->get_widget("btnNtpStop",_btnNtpStop); + builder->get_widget("btnNtpWinClose",_btnNtpWinClose); + builder->get_widget("lblNtpStop",_lblNtpStop); + builder->get_widget("lblNtpClose",_lblNtpClose); //builder->get_widget("cbxSynchronizeNtp",_cbxSynchronizeNtp); @@ -261,8 +266,18 @@ void MainWindow::event(){ _txtNtpServer->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_ntp)); _cldrDate->signal_day_selected_double_click().connect(sigc::mem_fun(*this, &MainWindow::get_calendar)); _mess_sudo->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::gui_exit_2)); + _btnNtpWinClose->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::wind_close_ntp)); + _btnNtpStop->signal_delete_event().connect(sigc::mem_fun(*this, &MainWindow::stop_ntp)); +} +void MainWindow::wind_close_ntp(){ + _windowsNnpClose->hide(); } +void MainWindow::stop_ntp(){ + +} + + void MainWindow::set_ntp_toggle(){ bool flag = _cbxSynchronizeNtpGlob->get_active(); if (flag_ntp==true || flag_datetime==true){ @@ -315,15 +330,23 @@ bool MainWindow::focus_ntp(GdkEventFocus* event){ void MainWindow::event_entry_cbDhcp(){ Glib::ustring str_dhcp = _cbDhcp->get_active_text(); + int activ_index = _cbDhcp->get_id_column(); if (str_dhcp.length()!=0){ - if (str_dhcp=="DHCP"){ + if (activ_index==0){ + string cmd = "/usr/bin/ubconfig set network NTPSERVERS=default"; + system(cmd.c_str()); + _txtNtpServer->set_sensitive(false); + _cbDhcp->set_active(activ_index); + _txtNtpServer->set_text(""); + } + else if (activ_index==1){ string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp"; system(cmd.c_str()); _txtNtpServer->set_sensitive(false); - _cbDhcp->set_active(0); + _cbDhcp->set_active(activ_index); _txtNtpServer->set_text(""); } - else{ + else if (activ_index==2){ string str_dhcp = this->call("/usr/bin/ubconfig get network NTPSERVERS"); if ((str_dhcp!="") && (str_dhcp!="(null)") ){ str_dhcp = str_dhcp.substr(str_dhcp.find("=")+1,str_dhcp.length()); @@ -332,7 +355,7 @@ void MainWindow::event_entry_cbDhcp(){ _txtNtpServer->set_text(str_dhcp); } _txtNtpServer->set_sensitive(true); - _cbDhcp->set_active(1); + _cbDhcp->set_active(activ_index); } } } diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index 20ff007..2629dad 100644 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -78,6 +78,8 @@ class MainWindow : public Gtk::ApplicationWindow { int check_root(); void gui_exit(); bool gui_exit_2(GdkEventAny* event); + void stop_ntp(); + void wind_close_ntp(); vector split(const std::string &s, char delim); private: Glib::RefPtr builder; @@ -119,6 +121,11 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Label *_lblTimeBios; Gtk::Button *_btnHardwareTime; Gtk::CheckButton *_cbxSynchronizeNtp; + Gtk::Window *_windowsNnpClose; + Gtk::Button *_btnNtpStop; + Gtk::Button *_btnNtpWinClose; + Gtk::Label *_lblNtpStop; + Gtk::Label *_lblNtpClose; std::map > time_reg_map; unsigned int year=0; unsigned int month=0; diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade index a919ff1..1313ccf 100644 --- a/ubl-settings-datetime.glade +++ b/ubl-settings-datetime.glade @@ -298,6 +298,7 @@ 160 True False + 5 5 5 5 @@ -380,6 +381,7 @@ 160 True False + 5 5 5 5 @@ -598,6 +600,7 @@ Format: DD.MM.YYYY 5 5 5 + 6 8 Region 0 @@ -616,6 +619,7 @@ Format: DD.MM.YYYY 5 5 5 + 6 8 @@ -632,6 +636,7 @@ Format: DD.MM.YYYY 5 10 5 + 6 8 Area 0 @@ -650,6 +655,7 @@ Format: DD.MM.YYYY 5 5 5 + 6 8 @@ -744,39 +750,51 @@ Format: DD.MM.YYYY 5 vertical - + True - False + True + False + Автоматическая синхронизация времени + 5 + 5 + 5 + 5 + 6 + True - + True - True - False - Автоматическая синхронизация времени + False 5 + 5 5 5 6 - True - - - True - False - Synchronize via NTP - - + 6 + Synchronize via NTP - - False - True - 0 - + + + False + True + 0 + + + + + True + False True False + 5 + 5 + 5 + 5 6 + 5 False @@ -795,6 +813,7 @@ Format: DD.MM.YYYY 5 5 6 + 5 True @@ -806,7 +825,7 @@ Format: DD.MM.YYYY False True - 0 + 1 @@ -843,6 +862,7 @@ Format: DD.MM.YYYY 5 5 5 + 6 8 Region 0 @@ -861,6 +881,7 @@ Format: DD.MM.YYYY 5 5 5 + 5 8 @@ -873,10 +894,11 @@ Format: DD.MM.YYYY True False - 5 + 10 5 10 5 + 5 8 Area 0 @@ -912,6 +934,8 @@ Format: DD.MM.YYYY 5 15 5 + 5 + 5 False @@ -932,7 +956,7 @@ Format: DD.MM.YYYY False True - 1 + 2 @@ -984,4 +1008,178 @@ Format: DD.MM.YYYY + + False + + + True + False + vertical + + + True + False + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + 50 + emblem-important + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 6 + 6 + Обнаружен активный сервис + автоматической синхронизации времени и даты + + + True + True + 1 + + + + + True + True + 0 + + + + + True + False + + + True + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + + + True + False + 5 + 5 + 5 + 5 + media-playback-stop + + + False + True + 0 + + + + + True + False + Остановить сервис синхронизации + + + False + True + 1 + + + + + + + True + True + 0 + + + + + True + True + True + 5 + 5 + 5 + 5 + 6 + 6 + + + True + False + + + True + False + 6 + 5 + 5 + 5 + window-close + + + False + True + 0 + + + + + True + False + Закрыть + + + False + True + 1 + + + + + + + True + True + 1 + + + + + False + True + 1 + + + + + diff --git a/ubl-settings-datetime_ru.po b/ubl-settings-datetime_ru.po index 7f7f769..b837623 100644 --- a/ubl-settings-datetime_ru.po +++ b/ubl-settings-datetime_ru.po @@ -6,6 +6,9 @@ msgid "" msgstr "" +msgid "By default" +msgstr "По умолчанию" + msgid "The program must be run with \nsuperuser privileges!" msgstr "Программа должна быть запущена с правами \nсуперпользователя!"