From eef5bcaa36aa8686cc6b02e58cce6a18a22cf7d1 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 2 Mar 2023 09:55:13 +0600 Subject: [PATCH 1/3] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D1=91=D0=BD?= =?UTF-8?q?=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-datetime.cc | 4 ++-- source/ubl-settings-datetime.h | 2 +- ubl-settings-datetime.glade | 37 ++++++++++++++++++++++++++------- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index a322279..f4cf60e 100755 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -436,13 +436,13 @@ void MainWindow::wrapper_system(string cmd){ } -void MainWindow::hardware_clock_global(string &local, string &utc){ +void MainWindow::hardware_clock_global(string &local, string &etc){ int index = cbHw->get_active_row_number(); if (index == 0){ wrapper_system(local); } else if (index == 1){ - wrapper_system(utc); + wrapper_system(etc); } } diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index 2069e94..dae17b1 100755 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -130,7 +130,7 @@ 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 hardware_clock_global(string &local, string &etc); void info_warning_error(int mess); void synopsis_show(); void entry_hardware_clock(string &cmd); diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade index e4f42de..285ef8b 100644 --- a/ubl-settings-datetime.glade +++ b/ubl-settings-datetime.glade @@ -1024,17 +1024,17 @@ Format: DD.MM.YYYY True False - 5 + 10 5 5 - 5 + 10 6 10 False False - False + True True 1 @@ -1082,6 +1082,7 @@ Format: DD.MM.YYYY + 167 True False 5 @@ -1132,7 +1133,7 @@ Format: DD.MM.YYYY False - False + True True 5 @@ -1266,7 +1267,16 @@ Format: DD.MM.YYYY - + + True + False + pan-down-symbolic + + + False + True + 1 + @@ -1322,7 +1332,16 @@ Format: DD.MM.YYYY - + + True + False + pan-down-symbolic + + + False + True + 1 + @@ -1343,7 +1362,11 @@ Format: DD.MM.YYYY none popAbout - + + True + False + open-menu-symbolic + From b5de7a52cda74a3bdf58a64036812884b39424de Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 2 Mar 2023 16:10:01 +0600 Subject: [PATCH 2/3] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B4=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD,=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-datetime.cc | 49 ++- source/ubl-settings-datetime.h | 19 +- style.css | 69 ++++ ubl-settings-datetime.glade | 560 ++++++++++++++------------------ 4 files changed, 338 insertions(+), 359 deletions(-) diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index f4cf60e..9be9a60 100755 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -223,7 +223,6 @@ void MainWindow::get_builder(){ builder->get_widget("btnUpdateDateTime", btnUpdateDateTime); builder->get_widget("btnChooseDate", btnChooseDate); builder->get_widget("btnMessClose", btnMessClose); - builder->get_widget("popCalendar", popCalendar); builder->get_widget("numTimeHrs", numTimeHrs); builder->get_widget("numTimeMin", numTimeMin); builder->get_widget("cbDhcp", cbDhcp); @@ -255,9 +254,6 @@ void MainWindow::get_builder(){ builder->get_widget("boxInfoError", boxInfoError); builder->get_widget("lblWarning", lblWarning); builder->get_widget("imgInfo", imgInfo); - builder->get_widget("popDownloadMenu", popDownloadMenu); - builder->get_widget("popSaveMenu", popSaveMenu); - builder->get_widget("popAbout", popAbout); builder->get_widget("btnSave", btnSave); builder->get_widget("btnSettings", btnSettings); builder->get_widget("btnDownload", btnDownload); @@ -272,6 +268,7 @@ void MainWindow::get_builder(){ builder->get_widget("lblHeader", lblHeader); builder->get_widget("lblHW", lblHW); builder->get_widget("cbHw", cbHw); + builder->get_widget("popCalendar", popCalendar); this->add_CSS(); } void MainWindow::gui_exit(){ @@ -295,22 +292,19 @@ void MainWindow::event(){ cbRegion->signal_changed().connect(sigc::mem_fun(*this, &MainWindow::append_zone)); 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)); - btnDownload->signal_clicked().connect([&](){popDownloadMenu->show();}); - btnSave->signal_clicked().connect([&](){popSaveMenu->show();}); - btnSettings->signal_clicked().connect([&](){popAbout->show();}); - btnAbout->signal_clicked().connect([&](){aboutWindows->show();}); - btnSynopsis->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); - btnDonwlodLocal->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::download_local_cfg)); - btnDonwlolGlob->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::download_globl_cfg)); - btnSaveLocalGlob->signal_clicked().connect([&](){save_global_local_cfg();}); - btnSaveLocal->signal_clicked().connect([&](){save_local_cfg();}); - btnSaveGlob->signal_clicked().connect([&](){save_global_cfg();}); + btnAbout->signal_activate().connect([&](){aboutWindows->show();}); + btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); + btnDonwlodLocal->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::download_local_cfg)); + btnDonwlolGlob->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::download_globl_cfg)); + btnSaveLocalGlob->signal_activate().connect([&](){save_global_local_cfg();}); + btnSaveLocal->signal_activate().connect([&](){save_local_cfg();}); + btnSaveGlob->signal_activate().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; @@ -336,7 +330,7 @@ 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"; + string hw = "/usr/bin/ubconfig get clock HWCLOCK_SYNC"; this->entry_hardware_clock(hw); info_warning_error(1); } @@ -428,7 +422,8 @@ void MainWindow::info_warning_error(int mess){ } -void MainWindow::wrapper_system(string cmd){ +void MainWindow::wrapper_system(string cmd, string thread_str=""){ + cmd=cmd + " " + thread_str; int response_cmd = system(cmd.c_str()); if (response_cmd!=0){ error_info+=1; @@ -439,10 +434,10 @@ void MainWindow::wrapper_system(string cmd){ void MainWindow::hardware_clock_global(string &local, string &etc){ int index = cbHw->get_active_row_number(); if (index == 0){ - wrapper_system(local); + wrapper_system(local, "&"); } else if (index == 1){ - wrapper_system(etc); + wrapper_system(etc, "&"); } } @@ -452,10 +447,14 @@ void MainWindow::entry_hardware_clock(string &cmd){ if (obj_result.response == "localtime"){ cbHw->set_active(0); } - else{ + 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(){ @@ -491,7 +490,7 @@ bool MainWindow::focus_ntp(string &cmd_set_ntp){ } if ((flag_error==false) && (flag_error_check_ntp==false)){ cmd = cmd_set_ntp + str_ntp + "\""; - wrapper_system(cmd); + wrapper_system(cmd, "&"); } else{ if (flag_error==true){ @@ -649,17 +648,17 @@ void MainWindow::save_Dhcp(string &cmd_default, string &cmd_dhcp, string &remove } else if (activ_index==0){ - wrapper_system(cmd_default); + wrapper_system(cmd_default, "&"); } else if (activ_index==1){ - wrapper_system(cmd_dhcp); + wrapper_system(cmd_dhcp, "&"); } else if (activ_index==2){ this->focus_ntp(cmd_set_ntp); } else if (activ_index==3){ int start_error = error_info; - wrapper_system(remove); + wrapper_system(remove, "&"); if (start_error != error_info){ error_info=start_error; } @@ -829,7 +828,7 @@ void MainWindow::enter_zone(string &cmd){ str_zone=zone_text; str_region=reg_text; cmd = cmd + str_region + "/" + str_zone; - wrapper_system(cmd); + wrapper_system(cmd, "&"); } else{ str_zone=""; diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index dae17b1..407c0b2 100755 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -62,9 +62,6 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Window *mess_dchp; Gtk::Window *mess_sudo; Gtk::Popover *popCalendar; - Gtk::Popover *popSaveMenu; - Gtk::Popover *popDownloadMenu; - Gtk::Popover *popAbout; Gtk::Calendar *cldrDate; Gtk::Label *lblMessage; Gtk::Label *lblMessageSudo; @@ -97,13 +94,13 @@ class MainWindow : public Gtk::ApplicationWindow { Gtk::Image *imgInfo; std::map > time_reg_map; std::map > time_reg_map_local; - Gtk::ModelButton *btnSaveLocalGlob; - Gtk::ModelButton *btnSaveLocal; - Gtk::ModelButton *btnSaveGlob; - Gtk::ModelButton *btnDonwlolGlob; - Gtk::ModelButton *btnDonwlodLocal; - Gtk::ModelButton *btnAbout; - Gtk::ModelButton *btnSynopsis; + Gtk::MenuItem *btnSaveLocalGlob; + Gtk::MenuItem *btnSaveLocal; + Gtk::MenuItem *btnSaveGlob; + Gtk::MenuItem *btnDonwlolGlob; + Gtk::MenuItem *btnDonwlodLocal; + Gtk::MenuItem *btnAbout; + Gtk::MenuItem *btnSynopsis; Gtk::HeaderBar *headerBar; Gtk::Label *lblHeader; Gtk::Label *lblHW; @@ -172,7 +169,7 @@ class MainWindow : public Gtk::ApplicationWindow { void gui_exit(); bool gui_exit_2(GdkEventAny* event); void wind_close_ntp(); - void wrapper_system(string cmd); + void wrapper_system(string cmd, string thread_str); void info_status_app(string stule); void wrapper_update_time_date(); string zone_file_read(string zone); diff --git a/style.css b/style.css index d8a3e99..6f3e7b9 100755 --- a/style.css +++ b/style.css @@ -13,4 +13,73 @@ .textHeaderBar{ font-weight: bold; } +.menuitemtop *{ + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; +} +.menuitemmiddle *{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; +} +.menuitembottom *{ + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; +} +.menuitemtop:hover { + background:@theme_bg_color; +} +.menuitemmiddle:hover { + background:@theme_bg_color; +} +.menuitembottom:hover { + background:@theme_bg_color; + +} +.menuitemtop:hover* { + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + border-color:transparent; +} +.menuitemmiddle:hover* { + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + border-color:transparent; +} +.menuitembottom:hover* { + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; + background:@theme_selected_bg_color; + border-radius:2px; + border-color:transparent; +} +.menuitembottom{ + margin-top:0px; + border-color:alpha(@theme_text_color, 0.4); + border-style:solid; + border-radius:0 0 5px 5px; + border-left-width:1px; + border-bottom-width:1px; + border-right-width:1px; +} +.menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; + border-color:alpha(@theme_text_color, 0.4); + border-style:solid; + border-left-width:1px; + border-right-width:1px; +} +.menuitemtop{ + margin-bottom:0px; + border-color:alpha(@theme_text_color, 0.4); + border-style:solid; + border-radius:5px 5px 0 0; + border-left-width:1px; + border-top-width:1px; + border-right-width:1px; +} \ No newline at end of file diff --git a/ubl-settings-datetime.glade b/ubl-settings-datetime.glade index 285ef8b..f07b79d 100644 --- a/ubl-settings-datetime.glade +++ b/ubl-settings-datetime.glade @@ -49,354 +49,101 @@ - + + True False - Внимание! - dialog + False + False + 4 - + 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 - - + Download local + True + - - - 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 - - + Download global + True + - + + True False + False + False + 4 - + 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 - - - - - - - - - + Synopsis + True + - - - False - + True False - 0 - none - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - True - True - True - Download local - - - False - True - 2 - - - - - True - True - True - Download global - - - False - True - 3 - - - - - - - - - + About the program + True + - + + True False + False + False + 4 - + True False - 0 - none - - - True - False - 5 - 5 - 5 - 5 - - - True - False - vertical - - - True - True - True - Save to global and local configuration - - - False - True - 3 - - - - - True - True - True - Save to local configuration - - - False - True - 4 - - - - - True - True - True - Save to Global configuration - - - False - True - 5 - - - - - - - - - + Save to global and local configuration + True + + + + + + True + False + Save to local configuration + True + + + + + + True + False + Save to Global configuration + True + @@ -1244,8 +991,8 @@ Format: DD.MM.YYYY False True True + menu none - popDownloadMenu True @@ -1306,8 +1053,8 @@ Format: DD.MM.YYYY False True True + menu2 none - popSaveMenu True @@ -1359,8 +1106,8 @@ Format: DD.MM.YYYY False True True + menu1 none - popAbout True @@ -1410,4 +1157,171 @@ Format: DD.MM.YYYY + + 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 + + + + + From 6410c4ca67df45dab0e1cee3386c4ac9f1b36c2e Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 2 Mar 2023 17:13:17 +0600 Subject: [PATCH 3/3] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-datetime.cc | 2 +- ubl-settings-datetime.desktop | 2 +- ubl-settings-datetime_ru.po | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 9be9a60..4261d6d 100755 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -141,7 +141,7 @@ void MainWindow::lacalization(){ cbDhcp->append(_("Disabled")); lblDateTimeSetting->set_text(_("Current date and time")); - lblHead->set_text(_("Settings the date and time")); + lblHead->set_text(_("Setting the date and time")); lblTime->set_text(_("Time")); lblData->set_text(_("Date")); lblTimeZone->set_text(_("Time zone")); diff --git a/ubl-settings-datetime.desktop b/ubl-settings-datetime.desktop index 9c4cd2e..6ed43e7 100755 --- a/ubl-settings-datetime.desktop +++ b/ubl-settings-datetime.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Encoding=UTF-8 Name=Date & time settings -Name[ru]=Настройка даты времени +Name[ru]=Настройка даты и времени GenericName=Date & time settings GenericName[ru]=Настройка даты и времени Comment=Date time settings diff --git a/ubl-settings-datetime_ru.po b/ubl-settings-datetime_ru.po index 25c7331..c4ddd6c 100755 --- a/ubl-settings-datetime_ru.po +++ b/ubl-settings-datetime_ru.po @@ -62,7 +62,7 @@ msgid "OK" msgstr "OK" msgid "Setting the date and time" -msgstr "Настройка даты времени" +msgstr "Настройка даты и времени" msgid "Successfully saved local and global configuration" msgstr "Успешно сохранена локальная и глобальная конфигурация" @@ -83,7 +83,7 @@ msgid "Change the NTPSERVERS parameter" msgstr "Изменить параметр NTPSERVERS" msgid "ubl-settings-datetime" -msgstr "Настройки даты и времени" +msgstr "Настройка даты и времени" msgid "Time" msgstr "Время"