From 94ebe29dc6cdc0c0bb49b0f2a0f0d7cdf710c4a4 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Fri, 10 Feb 2023 20:51:41 +0600 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20tooltip,=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ublexec.cc | 46 ++++++++++++++-------------------------------- source/ublexec.h | 23 +---------------------- 2 files changed, 15 insertions(+), 54 deletions(-) diff --git a/source/ublexec.cc b/source/ublexec.cc index 1dd39c7..bbd3f3f 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -35,7 +35,6 @@ using namespace std; string path_app= "/usr/bin/"; string path_glade= "/usr/share/ublexec/ui/ublexec.glade"; string path_css = "/usr/share/ublexec/css/style.css"; -//string path_app = "/home/superadmin/Документы/Проект/ubconfig_new/ubcall/"; string app_name = "ublexec"; 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} { @@ -49,18 +48,18 @@ CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_descr ::Window CmdArgParser::GetSocketID() const{ return m_socketID; } + MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder) : Gtk::ApplicationWindow(obj), builder{builder} { this->builder = builder; this->settings(); - } +} + MainWindow::MainWindow(Glib::RefPtr const& builder) { this->builder = builder; this->settings(); } - - void MainWindow::get_builder(){ builder->get_widget("btnFilemaneg", btnFilemaneg); builder->get_widget("btnListApp", btnListApp); @@ -80,7 +79,6 @@ void MainWindow::get_builder(){ builder->get_widget("btnFilemangerOk", btnFilemangerOk); builder->get_widget("lblTimeEpriorityLow", lblTimeEpriorityLow); builder->get_widget("lblTime4EpriorityHigh", lblTime4EpriorityHigh); - //builder->get_widget("lblUserName", lblUserName); builder->get_widget("messageError", messageError); builder->get_widget("lblMessageError", lblMessageError); builder->get_widget("btnMessageErrorOk", btnMessageErrorOk); @@ -121,12 +119,8 @@ void MainWindow::get_builder(){ builder->get_widget("iconDevelopment", iconDevelopment); builder->get_widget("iconSystem", iconSystem); builder->get_widget("lblSystem", lblSystem); - - - } - void MainWindow::set_icon_array(){ array_icon[0]=this->iconGraphics; array_icon[1]=this->iconTools; @@ -217,8 +211,6 @@ void MainWindow::event(){ iconOther->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Other)); iconDevelopment->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Development)); iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System)); - - } void MainWindow::icon_clear(){ @@ -271,8 +263,6 @@ void MainWindow::select_System(){ this->tempate_icon_select(this->iconSystem,list_System); } void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr >k_list){ - - auto selected = (*icon).get_selected_items(); if(!selected.empty()) { @@ -301,12 +291,8 @@ void MainWindow::unselect_icon(Gtk::IconView *icon_entry){ for (int index=0; index<10; ++index){ Gtk::IconView *icon = this->array_icon[index]; if (icon_entry!=icon){ - cout << "11111" << endl; icon->unselect_all(); } - else{ - cout << "22222" << endl; - } } } @@ -332,8 +318,6 @@ void MainWindow::settings(){ rbPkexec->set_sensitive(false); rbSu->set_sensitive(false); rbSudo->set_sensitive(false); - - } void MainWindow::close_entry_app(){ this->icon_clear(); @@ -358,9 +342,11 @@ void MainWindow::activ_or_block_execute_epriority(){ void MainWindow::open_filemaneg(){ wndChooseFileWallpaper->show(); } + void MainWindow::close_filemaneg(){ wndChooseFileWallpaper->hide(); } + void MainWindow::get_path_filemaneg(){ path_file = wndChooseFileWallpaper->get_filename(); if (path_file.length()==0){} @@ -386,7 +372,6 @@ void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::Ref void MainWindow::open_list_app(){ this->template_apps_obj(iconGraphics, list_Graphics); - this->template_apps_obj(iconTools, list_Tools); this->template_apps_obj(iconInternet, list_Internet); this->template_apps_obj(iconMultimedia, list_Multimedia); @@ -434,12 +419,10 @@ void MainWindow::open_list_app(){ } } dialogStartMenu->show_all(); - } void MainWindow::start_cmd(){ - //txtCmd->set_text(""); string str_cmd_terminal=""; string str_variants_root = ""; string str_nice_cmd = ""; @@ -477,7 +460,7 @@ void MainWindow::start_cmd(){ str_variants_root="su --user " + cmbUser->get_active_text() + " "; } else{ - str_variants_root="su" ; + str_variants_root="su"; } } else if (rbSudo->get_active()){ @@ -530,7 +513,6 @@ void MainWindow::start_cmd(){ txtCmd->set_text(cmd); cmd = cmd + " &"; system(cmd.c_str()); - path_file_name = ""; path_file = ""; name_app = ""; @@ -556,15 +538,12 @@ void MainWindow::changed_user(){ lblTime4EpriorityHigh->set_text("0 (Высокий)"); } } -//void MainWindow::execute_terminal(){} -//void MainWindow::execute_another_User(){} + void MainWindow::activ_or_block_other_user(){ bool flag = chbAnotherUser->get_active(); cmbUser->set_active(0); cmbUser->set_sensitive(flag); - lblInfoUserName->set_sensitive(flag); - //lblInfoUserOther->set_sensitive(flag); - + lblInfoUserName->set_sensitive(flag); if (flag_pkexec==true){ rbPkexec->set_sensitive(flag); } @@ -575,12 +554,15 @@ void MainWindow::activ_or_block_other_user(){ rbSudo->set_sensitive(flag); } } + void MainWindow::change_scale_priority(){ scalePriority->set_value(spinPriority->get_value_as_int()); } + void MainWindow::change_spin_priority(){ spinPriority->set_value(scalePriority->get_value()); } + void MainWindow::pars_dir_bin(){ namespace fs = std::filesystem; std::string path = "/bin"; @@ -601,9 +583,10 @@ void MainWindow::pars_dir_bin(){ rbSu->set_sensitive(flag_su); rbSudo->set_sensitive(flag_sudo); } + void MainWindow::pars_users(){ while (true) { - errno = 0; // so we can distinguish errors from no more entries + errno = 0; passwd* entry = getpwent(); if (!entry) { if (errno) { @@ -616,7 +599,6 @@ void MainWindow::pars_users(){ cmbUser->append(entry->pw_name); } } - cmbUser->append("root"); endpwent(); } @@ -627,7 +609,6 @@ vector MainWindow::split(const std::string &s, char delim) { std::vector elems; while (std::getline(ss, item, delim)) { elems.push_back(item); - // elems.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson) } return elems; } @@ -687,6 +668,7 @@ void MainWindow::pars_apps(){ list_app.push_back(App); } } + SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr builder) : Gtk::Plug{p_socketID} { MainWindow* wnd = nullptr; diff --git a/source/ublexec.h b/source/ublexec.h index 2154caa..7e79849 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -36,28 +36,17 @@ extern string app_name; extern string path_glade; extern string path_css; - class CmdArgParser : public Glib::OptionGroup { - public: - CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help); - ::Window GetSocketID() const; private: - int m_socketID = 0; }; -// This is what is going to be plugged into xfce4-settings-manager: -// -// Documented here: -// -// https://developer.gnome.org/gtkmm-tutorial/3.22/sec-plugs-sockets-example.html.en -// class MainWindow : public Gtk::ApplicationWindow { public: MainWindow(BaseObjectType* obj, Glib::RefPtr const& builder); @@ -106,12 +95,10 @@ public: void unselect_icon(Gtk::IconView *icon_entry); string str_remove(std::string& source, const std::string& to_remove); vector split(const std::string &s, char delim); - public: class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: - ModelColumns() { add(m_col_filename); @@ -120,14 +107,11 @@ public: add(app_name_exec); } - Gtk::TreeModelColumn m_col_filename; Gtk::TreeModelColumn m_col_description; Gtk::TreeModelColumn app_name_exec; Gtk::TreeModelColumn > m_col_pixbuf; - }; - ModelColumns m_Columns; public: Glib::RefPtr builder; @@ -203,10 +187,6 @@ public: Glib::RefPtr list_Other; Glib::RefPtr list_Development; Glib::RefPtr list_System; - - - - public: string execute_cmd = ""; string path_file = ""; @@ -222,8 +202,7 @@ public: string Icon; string MimeType; string Type; - vector Categories; - }; + vector Categories;}; list list_app; set set_categories; int index_exec_gui_apps = 0;