From be48cf2c97c3281da9fdb2a3765b98e4489c584d Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Mon, 24 Apr 2023 17:00:58 +0600 Subject: [PATCH] =?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=B1=D0=B0=D0=B3=20=D1=81=20=D0=B2=D1=8B=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=BC=20=D0=B1=D1=80=D0=B0=D1=83=D0=B7=D0=B5?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-datetime.cc | 29 ++++++++++++++++++----------- source/ubl-settings-datetime.h | 2 ++ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/source/ubl-settings-datetime.cc b/source/ubl-settings-datetime.cc index 04f89c1..227f8a6 100755 --- a/source/ubl-settings-datetime.cc +++ b/source/ubl-settings-datetime.cc @@ -436,21 +436,28 @@ void MainWindow::open_browser() { webkit_web_view_load_uri(one, link_doc); wndWeb->show_all(); } + else { + this->template_open_browser(); + } #else - string cmd = cmd_xdg + string(_(link_doc)) + " &"; - string buf = ""; - if (geteuid() == 0) { - string response_user = getlogin(); - int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1; - auto size = static_cast(size_s); - std::unique_ptr buf(new char[ size ]); - std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); - cmd = std::string( buf.get(), buf.get() + size - 1 ); - } - obj_process_system.call(cmd, "&"); + this->template_open_browser(); #endif } +void MainWindow::template_open_browser() { + string cmd = cmd_xdg + string(_(link_doc)) + " &"; + string buf = ""; + if (geteuid() == 0) { + string response_user = getlogin(); + int size_s = std::snprintf(nullptr, 0, cmd_execute, response_user.c_str(), cmd.c_str()) + 1; + auto size = static_cast(size_s); + std::unique_ptr buf(new char[ size ]); + std::snprintf( buf.get(), size, cmd_execute, response_user.c_str(), cmd.c_str() ); + cmd = std::string( buf.get(), buf.get() + size - 1 ); + } + index_error = system(cmd.c_str()); +} + void MainWindow::load_local_cfg() { flag_local_global_load = 0; flag_load = false; diff --git a/source/ubl-settings-datetime.h b/source/ubl-settings-datetime.h index 703b510..98d2835 100644 --- a/source/ubl-settings-datetime.h +++ b/source/ubl-settings-datetime.h @@ -147,6 +147,7 @@ class MainWindow : public Gtk::ApplicationWindow { int error_info = 0; int warning_info = 0; string cmd_error = ""; + int index_error = 0; int flag_local_global_load = 2; int hour; int minute; @@ -188,6 +189,7 @@ class MainWindow : public Gtk::ApplicationWindow { void fill_in_reg_zone(string cmd); void load_globl_cfg(); void save_local_cfg(); + void template_open_browser(); void event_zone(); bool focus_ntp(GdkEventFocus* event); bool check_config(string key, int key_save);