From e68202ce39708e132a105a7047fbcfc70d272035 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Wed, 15 Feb 2023 09:12:22 +0600 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=20=D0=B2=D0=BD?= =?UTF-8?q?=D0=B5=D1=81=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=B1=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D1=88=D0=B8=D1=85=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nohup.out | 21 ++++++++++++++ source/main.cc | 7 +++++ source/ubl-settings-datetime.cc | 46 +++++++++++++++--------------- source/ubl-settings-datetime.h | 5 ++-- style.css | 2 +- ubl-settings-datetime.desktop | 3 +- ubl-settings-datetime.glade | 50 ++++++++++++++++----------------- ubl-settings-datetime_ru.po | 4 +-- 8 files changed, 85 insertions(+), 53 deletions(-) create mode 100644 nohup.out diff --git a/nohup.out b/nohup.out new file mode 100644 index 0000000..48125d2 --- /dev/null +++ b/nohup.out @@ -0,0 +1,21 @@ +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list +xhost: bad hostname "superadmin" +X Error of failed request: BadValue (integer parameter out of range for operation) + Major opcode of failed request: 109 (X_ChangeHosts) + Value in failed request: 0xa + Serial number of failed request: 7 + Current serial number in output stream: 9 +localuser: being added to access control list diff --git a/source/main.cc b/source/main.cc index f423a3a..4c57ffb 100644 --- a/source/main.cc +++ b/source/main.cc @@ -25,17 +25,24 @@ int main(int argc, char* argv[]) { auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.plug"); auto builder = Gtk::Builder::create_from_file(path_glade + "ubl-settings-datetime.glade"); Glib::init(); + setlocale(LC_ALL, ""); Glib::OptionContext context; + CmdArgParser parser{ "Socket ID", "Command line argument for socket ID communication.", "No help available, sorry" }; + context.set_main_group(parser); context.parse(argc, argv); + ::Window socketID = parser.GetSocketID(); + + // Handle plug: SettingsPlug plug{socketID, builder}; plug.show(); + app->run(plug); return 0; } diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 9db3e71..c9a2324 100644 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -46,29 +46,26 @@ bool flag_ntp = false; bool flag_update = false; CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help) -: Glib::OptionGroup{p_name, p_description, p_help} -{ +: Glib::OptionGroup{p_name, p_description, p_help} { Glib::OptionEntry socketIDArg; socketIDArg.set_long_name("socket-id"); socketIDArg.set_short_name('s'); socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); socketIDArg.set_description("Settings manager socket"); - cout << m_socketID << endl; add_entry(socketIDArg, m_socketID); } - -::Window CmdArgParser::GetSocketID() const { +::Window CmdArgParser::GetSocketID() const{ return m_socketID; } MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder) - : Gtk::ApplicationWindow(obj) - , builder{builder} { - this->settings(); + : Gtk::ApplicationWindow(obj), builder{builder} { + this->builder = builder; + this->settings(); } MainWindow::MainWindow(Glib::RefPtr const& builder) { - this->builder = builder; + this->builder = builder; this->settings(); } @@ -126,7 +123,7 @@ int MainWindow::check_root(){ void MainWindow::lacalization(){ txtDate->set_tooltip_text(_("Date of\nFormat: DD.MM.YYYY")); txtNtpServer->set_tooltip_text(_("Enter the name of the ntp-server or its ip-address.\nWhen entering multiple addresses, separate them with commas.")); - lblSynchronizebChkGLob->set_text(_("Synchronize via NTP")); + lblSynchronizebChkGLob->set_text(_("Synchronize via NTP:")); cbDhcp->append(_("Default")); cbDhcp->append(_("DHCP")); cbDhcp->append(_("Manual")); @@ -202,8 +199,10 @@ void MainWindow::add_CSS(){ styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application Glib::RefPtr context = boxColor->get_style_context(); Glib::RefPtr context_lbl_head = lblHead->get_style_context(); + //Glib::RefPtr context_button = btnHardwareTime->get_style_context(); context->add_class("cssboxColor1"); context_lbl_head->add_class("textHead"); + //context_button->add_class("textHead"); } void MainWindow::get_builder(){ @@ -385,13 +384,15 @@ void MainWindow::event_entry_cbDhcp(){ } cbDhcp->set_active(activ_index); } - } } else if (activ_index==3){ - system("/usr/bin/ubconfig remove network NTPSERVERS"); + string cmd = "/usr/bin/ubconfig remove network NTPSERVERS"; + system(cmd.c_str()); txtNtpServer->set_text(""); txtNtpServer->set_sensitive(false); + } } + else{ string cmd = "/usr/bin/ubconfig set network NTPSERVERS=dhcp"; system(cmd.c_str()); @@ -865,14 +866,14 @@ void MainWindow::sort_zone(vector *time_reg_map_local,vector *ti j_i_1 = stoi(str_j_1); j_i_1 = -j_i_1; } - if (j_i > j_i_1) { - string b = (*time_reg_map_local)[j]; - (*time_reg_map_local)[j] = (*time_reg_map_local)[j + 1]; - (*time_reg_map_local)[j + 1] = b; + if (j_i > j_i_1) { + string b = (*time_reg_map_local)[j]; + (*time_reg_map_local)[j] = (*time_reg_map_local)[j + 1]; + (*time_reg_map_local)[j + 1] = b; - b = (*time_reg_map)[j]; - (*time_reg_map)[j] = (*time_reg_map)[j + 1]; - (*time_reg_map)[j + 1] = b; + b = (*time_reg_map)[j]; + (*time_reg_map)[j] = (*time_reg_map)[j + 1]; + (*time_reg_map)[j + 1] = b; } } } @@ -925,9 +926,10 @@ vector MainWindow::split(const std::string &s, char delim){ } SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr builder) -: Gtk::Plug{p_socketID} -{ - builder->get_widget("id_plug", plugBox); + : Gtk::Plug{p_socketID} { + MainWindow* wnd = nullptr; + builder->get_widget_derived("window", wnd); + builder->get_widget("plugBox", plugBox); plugBox->get_parent()->remove(*plugBox); add(*plugBox); show_all_children(); diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index e72a8b1..c4164cc 100644 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -30,6 +30,7 @@ public: ::Window GetSocketID() const; private: int m_socketID = 0; + }; class MainWindow : public Gtk::ApplicationWindow { @@ -152,11 +153,11 @@ class MainWindow : public Gtk::ApplicationWindow { "US"}; }; -class SettingsPlug : public Gtk::Plug -{ +class SettingsPlug : public Gtk::Plug{ public: Gtk::Window *window; SettingsPlug(::Window p_socketID, Glib::RefPtr builder); + private: Gtk::Widget *plugBox; Gtk::Widget *parent; diff --git a/style.css b/style.css index 8c5d210..88c8a58 100644 --- a/style.css +++ b/style.css @@ -3,4 +3,4 @@ } .textHead{ text-shadow: 1px 1px #ffffff; -} \ No newline at end of file +} diff --git a/ubl-settings-datetime.desktop b/ubl-settings-datetime.desktop index 8e07f0d..436b551 100644 --- a/ubl-settings-datetime.desktop +++ b/ubl-settings-datetime.desktop @@ -7,7 +7,8 @@ GenericName[ru]=Настройка даты и времени Comment=Date time settings Comment[ru]=Приложение для настройки даты и времени Type=Application -Exec=pkexec ubl-settings-datetime +Exec=ubl-settings-datetime Icon=ubl-settings-datetime Terminal=false +X-XfcePluggable=true Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;X-UBL-SettingsManager;X-UBL-SystemSettings; \ No newline at end of file diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade index 7370d8c..b207f15 100644 --- a/ubl-settings-datetime.glade +++ b/ubl-settings-datetime.glade @@ -169,29 +169,6 @@ - - 240 - 185 - False - btnChooseDate - bottom - none - - - True - True - 10 - 10 - 10 - 10 - 10 - 10 - 2023 - 1 - 10 - - - False Настройки даты и времени @@ -201,7 +178,7 @@ False vertical - + True False vertical @@ -794,7 +771,7 @@ Format: DD.MM.YYYY 5 6 6 - Synchronize via NTP + Synchronize via NTP: False @@ -1015,6 +992,29 @@ Format: DD.MM.YYYY + + 240 + 185 + False + btnChooseDate + bottom + none + + + True + True + 10 + 10 + 10 + 10 + 10 + 10 + 2023 + 1 + 10 + + + False diff --git a/ubl-settings-datetime_ru.po b/ubl-settings-datetime_ru.po index b32e1e6..c414d4c 100644 --- a/ubl-settings-datetime_ru.po +++ b/ubl-settings-datetime_ru.po @@ -97,8 +97,8 @@ msgstr "Синхронизировать" msgid "Automatic time synchronization" msgstr "Автоматическая синхронизация времени" -msgid "Synchronize via NTP" -msgstr "Синхронизировать через NTP" +msgid "Synchronize via NTP:" +msgstr "Синхронизировать через NTP:" msgid "Time zone" msgstr "Часовой пояс"