Частично код приведён стандарту Стэнфордского университет

pull/12/head
Igor Belitskiy 3 years ago
parent 42e104243c
commit 881f9f08ec

@ -1,17 +1,10 @@
#include "ublexec.h" #include "ublexec.h"
int main(int argc, char** argv) int main(int argc, char** argv) {
{
string str_cmd_argv = ""; string str_cmd_argv = "";
for (int i=1; i<argc; i++){ for (int i=1; i<argc; i++){
str_cmd_argv+= to_string(*argv[i]) + " "; str_cmd_argv += to_string(*argv[i]) + " ";
}
if (geteuid()!=0){
//string cmd = "pkexec " + app_name + " " + str_cmd_argv;
//system(cmd.c_str());
//return 0;
} }
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.plug"); auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.plug");
auto builder = Gtk::Builder::create_from_file(path_glade); auto builder = Gtk::Builder::create_from_file(path_glade);
@ -19,11 +12,10 @@ int main(int argc, char** argv)
bindtextdomain("ublexec", "/usr/share/locale/"); bindtextdomain("ublexec", "/usr/share/locale/");
bind_textdomain_codeset("ublexec", "UTF-8"); bind_textdomain_codeset("ublexec", "UTF-8");
textdomain("ublexec"); textdomain("ublexec");
if (argc!=1){ if (argc != 1){
Glib::init(); Glib::init();
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
Glib::OptionContext context; Glib::OptionContext context;
CmdArgParser parser{ CmdArgParser parser{
"Socket ID", "Socket ID",
"Command line argument for socket ID communication.", "Command line argument for socket ID communication.",
@ -32,18 +24,13 @@ int main(int argc, char** argv)
context.set_main_group(parser); context.set_main_group(parser);
context.parse(argc, argv); context.parse(argc, argv);
::Window socketID = parser.GetSocketID(); ::Window socketID = parser.GetSocketID();
// Handle plug:
SettingsPlug plug{socketID, builder}; SettingsPlug plug{socketID, builder};
plug.show(); plug.show();
app->run(plug); app->run(plug);
return 0; return 0;
} }
else { else {
MainWindow* wnd = nullptr; MainWindow* wnd = nullptr;
builder->get_widget_derived("window", wnd); builder->get_widget_derived("window", wnd);
auto r = app->run(*wnd); auto r = app->run(*wnd);

@ -1,28 +1,25 @@
#include "ublexec.h" #include "ublexec.h"
using namespace std; using namespace std;
string path_app= "/usr/bin/"; const string path_app = "/usr/bin/";
string path_glade= "/usr/share/ublexec/ui/ublexec.glade"; const string path_glade = "/usr/share/ublexec/ui/ublexec.glade";
string path_css = "/usr/share/ublexec/css/style.css"; const string path_css = "/usr/share/ublexec/css/style.css";
string app_name = "ublexec"; const string app_name = "ublexec";
int socket_ext_id_I=0; int socket_ext_id_I = 0;
int socket_trd_id_I=0; int socket_trd_id_I = 0;
CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help) 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; Glib::OptionEntry socketIDArg;
socketIDArg.set_long_name("socket-id"); socketIDArg.set_long_name("socket-id");
socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
socketIDArg.set_description("Settings manager socket"); socketIDArg.set_description("Settings manager socket");
Glib::OptionEntry socketExtId; Glib::OptionEntry socketExtId;
socketExtId.set_long_name("socket-ext-id"); socketExtId.set_long_name("socket-ext-id");
socketExtId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); socketExtId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
socketExtId.set_description("Settings manager secondary socket"); socketExtId.set_description("Settings manager secondary socket");
Glib::OptionEntry socketTrdId; Glib::OptionEntry socketTrdId;
socketTrdId.set_long_name("socket-trd-id"); socketTrdId.set_long_name("socket-trd-id");
socketTrdId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN); socketTrdId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
socketTrdId.set_description("Settings manager secondary socket"); socketTrdId.set_description("Settings manager secondary socket");
add_entry(socketIDArg, m_socketID); add_entry(socketIDArg, m_socketID);
add_entry(socketExtId, socket_ext_id_I); add_entry(socketExtId, socket_ext_id_I);
add_entry(socketTrdId, socket_trd_id_I); add_entry(socketTrdId, socket_trd_id_I);
@ -42,7 +39,7 @@ MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) {
this->settings(); this->settings();
} }
void MainWindow::get_builder(){ void MainWindow::get_builder() {
builder->get_widget("btnFilemaneg", btnFilemaneg); builder->get_widget("btnFilemaneg", btnFilemaneg);
builder->get_widget("btnListApp", btnListApp); builder->get_widget("btnListApp", btnListApp);
builder->get_widget("btnStart", btnStart); builder->get_widget("btnStart", btnStart);
@ -108,27 +105,27 @@ void MainWindow::get_builder(){
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog); builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
} }
void MainWindow::set_icon_array(){ void MainWindow::set_icon_array() {
array_icon[0]=this->iconGraphics; array_icon[0] = this->iconGraphics;
array_icon[1]=this->iconTools; array_icon[1] = this->iconTools;
array_icon[2]=this->iconInternet; array_icon[2] = this->iconInternet;
array_icon[3]=this->iconMultimedia; array_icon[3] = this->iconMultimedia;
array_icon[4]=this->iconSettings; array_icon[4] = this->iconSettings;
array_icon[5]=this->iconEducation; array_icon[5] = this->iconEducation;
array_icon[6]=this->iconOffice; array_icon[6] = this->iconOffice;
array_icon[7]=this->iconOther; array_icon[7] = this->iconOther;
array_icon[8]=this->iconDevelopment; array_icon[8] = this->iconDevelopment;
array_icon[9]=this->iconSystem; array_icon[9] = this->iconSystem;
} }
void MainWindow::template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list_app){ void MainWindow::template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list_app) {
gtk_list_app = Gtk::ListStore::create(m_Columns); gtk_list_app = Gtk::ListStore::create(m_Columns);
gtk_list_app->set_sort_column(m_Columns.m_col_description, Gtk::SORT_ASCENDING); gtk_list_app->set_sort_column(m_Columns.m_col_description, Gtk::SORT_ASCENDING);
icon->set_model(gtk_list_app); icon->set_model(gtk_list_app);
icon->set_text_column(m_Columns.m_col_description); icon->set_text_column(m_Columns.m_col_description);
} }
void MainWindow::add_CSS(){ void MainWindow::add_CSS() {
Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create(); Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create();
cssProvider->load_from_path(path_css); cssProvider->load_from_path(path_css);
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create(); Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
@ -140,7 +137,7 @@ void MainWindow::add_CSS(){
context_lbl_head->add_class("textHead"); context_lbl_head->add_class("textHead");
} }
void MainWindow::localization(){ void MainWindow::localization() {
aboutWindows->set_website(_("https://wiki.ublinux.com")); aboutWindows->set_website(_("https://wiki.ublinux.com"));
btnSynopsis->set_label(_("Help")); btnSynopsis->set_label(_("Help"));
btnAbout->set_label(_("About the program")); btnAbout->set_label(_("About the program"));
@ -175,7 +172,7 @@ void MainWindow::localization(){
lblSystem->set_text(_("System")); lblSystem->set_text(_("System"));
} }
void MainWindow::event(){ void MainWindow::event() {
btnFilemaneg->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_filemaneg)); btnFilemaneg->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_filemaneg));
btnListApp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_list_app)); btnListApp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_list_app));
btnStart->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::entry_app)); btnStart->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::entry_app));
@ -201,15 +198,16 @@ void MainWindow::event(){
iconDevelopment->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Development)); iconDevelopment->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Development));
iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System)); iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System));
btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show));
btnAbout->signal_activate().connect([&](){aboutWindows->show();}); btnAbout->signal_activate().connect([&]() {aboutWindows->show();});
cmbUser->signal_changed().connect([&](){denamic_cmd();changed_user();}); cmbUser->signal_changed().connect([&]() {denamic_cmd();changed_user();});
rbSudo->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd)); rbSudo->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd));
txtCmd->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_cmd)); txtCmd->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_txt_cmd));
txtCmd->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_in_txt_cmd)); txtCmd->signal_focus_in_event().connect(sigc::mem_fun(*this, &MainWindow::focus_in_txt_cmd));
txtCmd->signal_delete_text().connect(sigc::mem_fun(*this, &MainWindow::delete_cmd)); txtCmd->signal_delete_text().connect(sigc::mem_fun(*this, &MainWindow::delete_cmd));
} }
void MainWindow::delete_cmd(const int &x,const int &y){
if (y>1){ void MainWindow::delete_cmd(const int &x, const int &y) {
if (y > 1) {
chbTerminal->set_active(false); chbTerminal->set_active(false);
chbAnotherUser->set_active(false); chbAnotherUser->set_active(false);
cbxExecuteEpriority->set_active(false); cbxExecuteEpriority->set_active(false);
@ -217,15 +215,12 @@ void MainWindow::delete_cmd(const int &x,const int &y){
} }
} }
bool MainWindow::focus_in_txt_cmd(GdkEventFocus* event){ bool MainWindow::focus_in_txt_cmd(GdkEventFocus* event) {
if (user_cmd.length() != 0){ if (user_cmd.length() != 0) {
//user_cmd_old = user_cmd;gi
} }
else if (name_app.length() != 0){ else if (name_app.length() != 0) {
//name_app_old = name_app;
} }
else if (path_file.length() != 0){ else if (path_file.length() != 0) {
//path_file_old = path_file;
} }
else{ else{
user_cmd = txtCmd->get_text(); user_cmd = txtCmd->get_text();
@ -234,12 +229,11 @@ bool MainWindow::focus_in_txt_cmd(GdkEventFocus* event){
return true; return true;
} }
void MainWindow::synopsis_show() {
void MainWindow::synopsis_show(){
system("xdg-open https://wiki.ublinux.ru/ru/home &"); system("xdg-open https://wiki.ublinux.ru/ru/home &");
} }
void MainWindow::icon_clear(){ void MainWindow::icon_clear() {
list_Graphics->clear(); list_Graphics->clear();
list_Tools->clear(); list_Tools->clear();
list_Internet->clear(); list_Internet->clear();
@ -252,45 +246,44 @@ void MainWindow::icon_clear(){
list_System->clear(); list_System->clear();
} }
void MainWindow::ok_close_entry_app(){ void MainWindow::ok_close_entry_app() {
this->icon_clear(); this->icon_clear();
dialogStartMenu->hide(); dialogStartMenu->hide();
} }
void MainWindow::select_Graphics(){ void MainWindow::select_Graphics() {
this->tempate_icon_select(this->iconGraphics,list_Graphics); this->tempate_icon_select(this->iconGraphics, list_Graphics);
} }
void MainWindow::select_Tools(){ void MainWindow::select_Tools() {
this->tempate_icon_select(this->iconTools,list_Tools); this->tempate_icon_select(this->iconTools, list_Tools);
} }
void MainWindow::select_Internet(){ void MainWindow::select_Internet() {
this->tempate_icon_select(this->iconInternet,list_Internet); this->tempate_icon_select(this->iconInternet, list_Internet);
} }
void MainWindow::select_Multimedia(){ void MainWindow::select_Multimedia() {
this->tempate_icon_select(this->iconMultimedia,list_Multimedia); this->tempate_icon_select(this->iconMultimedia, list_Multimedia);
} }
void MainWindow::select_Settings(){ void MainWindow::select_Settings() {
this->tempate_icon_select(this->iconSettings,list_Settings); this->tempate_icon_select(this->iconSettings, list_Settings);
} }
void MainWindow::select_Education(){ void MainWindow::select_Education() {
this->tempate_icon_select(this->iconEducation,list_Education); this->tempate_icon_select(this->iconEducation, list_Education);
} }
void MainWindow::select_Office(){ void MainWindow::select_Office() {
this->tempate_icon_select(this->iconOffice,list_Office); this->tempate_icon_select(this->iconOffice, list_Office);
} }
void MainWindow::select_Other(){ void MainWindow::select_Other() {
this->tempate_icon_select(this->iconOther,list_Other); this->tempate_icon_select(this->iconOther, list_Other);
} }
void MainWindow::select_Development(){ void MainWindow::select_Development() {
this->tempate_icon_select(this->iconDevelopment,list_Development); this->tempate_icon_select(this->iconDevelopment, list_Development);
} }
void MainWindow::select_System(){ void MainWindow::select_System() {
this->tempate_icon_select(this->iconSystem,list_System); this->tempate_icon_select(this->iconSystem, list_System);
} }
void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list){ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> &gtk_list) {
auto selected = (*icon).get_selected_items(); auto selected = (*icon).get_selected_items();
if(!selected.empty()) if(!selected.empty()) {
{
this->set_icon_array(); this->set_icon_array();
this->unselect_icon(icon); this->unselect_icon(icon);
const Gtk::TreeModel::Path& path = *selected.begin(); const Gtk::TreeModel::Path& path = *selected.begin();
@ -304,10 +297,10 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::List
txtCmd->set_text(app_name_exec); txtCmd->set_text(app_name_exec);
name_app = txtCmd->get_text(); name_app = txtCmd->get_text();
int len_name_app = name_app.length(); int len_name_app = name_app.length();
string array_del[] = {"%f","%F","%d","%D","%n","%N","%U"}; string array_del[] = {"%f", "%F", "%d", "%D", "%n", "%N", "%U"};
for (auto &del_sim: array_del){ for (auto &del_sim: array_del) {
str_remove(name_app, del_sim); str_remove(name_app, del_sim);
if (name_app.length()!=len_name_app){ if (name_app.length() != len_name_app) {
txtCmd->set_text(name_app); txtCmd->set_text(name_app);
break; break;
} }
@ -315,24 +308,24 @@ void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::List
} }
} }
void MainWindow::unselect_icon(Gtk::IconView *icon_entry){ void MainWindow::unselect_icon(Gtk::IconView *icon_entry) {
for (int index=0; index<10; ++index){ for (int index=0; index<10; ++index) {
Gtk::IconView *icon = this->array_icon[index]; Gtk::IconView *icon = this->array_icon[index];
if (icon_entry!=icon){ if (icon_entry != icon) {
icon->unselect_all(); icon->unselect_all();
} }
} }
} }
void MainWindow::settings(){ void MainWindow::settings() {
this->pars_apps(); this->pars_apps();
this->get_builder(); this->get_builder();
this->event(); this->event();
this->localization(); this->localization();
this->add_CSS(); this->add_CSS();
spinPriority->set_range(0,19); spinPriority->set_range(0, 19);
spinPriority->set_increments(1.0,-1.0); spinPriority->set_increments(1.0, -1.0);
scalePriority->set_range(0,19); scalePriority->set_range(0, 19);
scalePriority->set_value(0); scalePriority->set_value(0);
lblTimeEpriorityLow->set_text("19 (Низкий)"); lblTimeEpriorityLow->set_text("19 (Низкий)");
lblTime4EpriorityHigh->set_text("0 (Высокий)"); lblTime4EpriorityHigh->set_text("0 (Высокий)");
@ -350,22 +343,21 @@ void MainWindow::settings(){
btnBoxAboutDialog->set_visible(false); btnBoxAboutDialog->set_visible(false);
Gtk::Widget *boxAbout; Gtk::Widget *boxAbout;
builder->get_widget("boxAbout",boxAbout); builder->get_widget("boxAbout",boxAbout);
ubl_make_plugs(boxAbout, boxAbout,0 , socket_trd_id_I);
}
ubl_make_plugs(boxAbout,boxAbout, 0, socket_trd_id_I); void MainWindow::close_entry_app() {
}
void MainWindow::close_entry_app(){
this->icon_clear(); this->icon_clear();
dialogStartMenu->hide(); dialogStartMenu->hide();
} }
void MainWindow::start_menu_entry_app(){} void MainWindow::start_menu_entry_app() {}
void MainWindow::message_gui_close(){ void MainWindow::message_gui_close() {
messageError->hide(); messageError->hide();
} }
void MainWindow::activ_or_block_execute_epriority(){ void MainWindow::activ_or_block_execute_epriority() {
bool flag = cbxExecuteEpriority->get_active(); bool flag = cbxExecuteEpriority->get_active();
scalePriority->set_sensitive(flag); scalePriority->set_sensitive(flag);
spinPriority->set_sensitive(flag); spinPriority->set_sensitive(flag);
@ -375,19 +367,19 @@ void MainWindow::activ_or_block_execute_epriority(){
this->denamic_cmd(); this->denamic_cmd();
} }
void MainWindow::open_filemaneg(){ void MainWindow::open_filemaneg() {
wndChooseFileWallpaper->show(); wndChooseFileWallpaper->show();
} }
void MainWindow::close_filemaneg(){ void MainWindow::close_filemaneg() {
wndChooseFileWallpaper->hide(); wndChooseFileWallpaper->hide();
} }
void MainWindow::get_path_filemaneg(){ void MainWindow::get_path_filemaneg() {
name_app = ""; name_app = "";
user_cmd = ""; user_cmd = "";
path_file = wndChooseFileWallpaper->get_filename(); path_file = wndChooseFileWallpaper->get_filename();
if (path_file.length() == 0){} if (path_file.length() == 0) {}
else{ else{
txtCmd->set_text(path_file); txtCmd->set_text(path_file);
this->close_filemaneg(); this->close_filemaneg();
@ -396,7 +388,7 @@ void MainWindow::get_path_filemaneg(){
this->denamic_cmd(); this->denamic_cmd();
} }
void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list){ void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list) {
Gtk::TreeModel::Row row = *(dtk_list->append()); Gtk::TreeModel::Row row = *(dtk_list->append());
row[m_Columns.m_col_filename] = path; row[m_Columns.m_col_filename] = path;
row[m_Columns.m_col_description] = Name; row[m_Columns.m_col_description] = Name;
@ -406,7 +398,7 @@ void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::Ref
row[m_Columns.float_w_align] = 0.5; row[m_Columns.float_w_align] = 0.5;
} }
void MainWindow::open_list_app(){ void MainWindow::open_list_app() {
this->template_apps_obj(iconGraphics, list_Graphics); this->template_apps_obj(iconGraphics, list_Graphics);
this->template_apps_obj(iconTools, list_Tools); this->template_apps_obj(iconTools, list_Tools);
this->template_apps_obj(iconInternet, list_Internet); this->template_apps_obj(iconInternet, list_Internet);
@ -418,37 +410,37 @@ void MainWindow::open_list_app(){
this->template_apps_obj(iconDevelopment, list_Development); this->template_apps_obj(iconDevelopment, list_Development);
this->template_apps_obj(iconSystem, list_System); this->template_apps_obj(iconSystem, list_System);
string path = ""; string path = "";
for ( const auto &st_app : list_app){ for ( const auto &st_app: list_app) {
for ( const auto &str_categor : st_app.Categories){ for ( const auto &str_categor: st_app.Categories) {
path = st_app.Icon; path = st_app.Icon;
if (str_categor=="Graphics"){ if (str_categor == "Graphics") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Graphics); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Graphics);
} }
else if (str_categor=="Utility"){ else if (str_categor == "Utility") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Tools); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Tools);
} }
else if (str_categor=="Network"){ else if (str_categor == "Network") {
this->tempalte_row(st_app.Name,st_app.Exec, path,list_Internet); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Internet);
} }
else if (str_categor== "AudioVideo"){ else if (str_categor == "AudioVideo") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Multimedia); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Multimedia);
} }
else if (str_categor=="Settings"){ else if (str_categor == "Settings") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Settings); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Settings);
} }
else if (str_categor=="Education"){ else if (str_categor == "Education") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Education); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Education);
} }
else if (str_categor=="Office"){ else if (str_categor == "Office") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Office); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Office);
} }
else if (str_categor=="Other"){ else if (str_categor == "Other") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Other); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Other);
} }
else if (str_categor=="Development"){ else if (str_categor == "Development") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Development); this->tempalte_row(st_app.Name,st_app.Exec, path, list_Development);
} }
else if (str_categor=="System"){ else if (str_categor == "System") {
this->tempalte_row(st_app.Name,st_app.Exec, path, list_System); this->tempalte_row(st_app.Name,st_app.Exec, path, list_System);
} }
} }
@ -457,96 +449,93 @@ void MainWindow::open_list_app(){
} }
string MainWindow::start_cmd(string user_cmd){ string MainWindow::start_cmd(string user_cmd) {
string str_cmd_terminal=""; string str_cmd_terminal = "";
string str_variants_root = ""; string str_variants_root = "";
string str_nice_cmd = ""; string str_nice_cmd = "";
if (chbAnotherUser->get_active()){ if (chbAnotherUser->get_active()) {
if (geteuid()!=0){ if (geteuid() != 0) {
//chbTerminal->set_active(true); //chbTerminal->set_active(true);
} }
if (rbPkexec->get_active()){ if (rbPkexec->get_active()) {
str_variants_root = " pkexec --user " + cmbUser->get_active_text(); str_variants_root = " pkexec --user " + cmbUser->get_active_text();
if (cbxExecuteEpriority->get_active()){ if (cbxExecuteEpriority->get_active()) {
str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int()); str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int());
} }
str_variants_root += " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; str_variants_root += " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
} }
else if (rbSu->get_active()){ else if (rbSu->get_active()) {
chbTerminal->set_active(true); chbTerminal->set_active(true);
string str_user = cmbUser->get_active_text(); string str_user = cmbUser->get_active_text();
if (str_user!="root"){ if (str_user != "root") {
str_variants_root = "su -l " + cmbUser->get_active_text(); str_variants_root = "su -l " + cmbUser->get_active_text();
} }
else{ else{
str_variants_root = "su "; str_variants_root = "su ";
} }
str_variants_root += + " -c \" DISPLAY=$DISPLAY "; str_variants_root += + " -c \" DISPLAY=$DISPLAY ";
if (cbxExecuteEpriority->get_active()){ if (cbxExecuteEpriority->get_active()) {
str_variants_root += "nice -n " + to_string(spinPriority->get_value_as_int()) + " "; str_variants_root += "nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
} }
} }
else if (rbSudo->get_active()){ else if (rbSudo->get_active()) {
chbTerminal->set_active(true); chbTerminal->set_active(true);
if (getlogin()==cmbUser->get_active_text()){ if (getlogin()==cmbUser->get_active_text()) {
str_variants_root="sudo "; str_variants_root="sudo ";
} }
else{ else{
str_variants_root="sudo -u " + cmbUser->get_active_text() + " "; str_variants_root="sudo -u " + cmbUser->get_active_text() + " ";
} }
if (cbxExecuteEpriority->get_active()){ if (cbxExecuteEpriority->get_active()) {
str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int()) + " "; str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
} }
} }
} }
if (cmbUser->get_active_text().length()!=0){ if (cmbUser->get_active_text().length() != 0) {
string user_cmd_X = "xhost +SI:localuser:"; string user_cmd_X = "xhost +SI:localuser:";
user_cmd_X += cmbUser->get_active_text(); user_cmd_X += cmbUser->get_active_text();
user_cmd_X += " > /dev/null 2>&1";
system(user_cmd_X.c_str()); system(user_cmd_X.c_str());
} }
if ((cbxExecuteEpriority->get_active()) && (chbAnotherUser->get_active()==false)){ if ((cbxExecuteEpriority->get_active()) && (chbAnotherUser->get_active() == false)) {
str_nice_cmd = " nice -n " + to_string(spinPriority->get_value_as_int()) + " "; str_nice_cmd = " nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
} }
if (user_cmd.length()==0 && name_app.length()==0 && path_file.length()==0){ if (user_cmd.length() == 0 && name_app.length() == 0 && path_file.length() == 0) {
messageError->show(); messageError->show();
return ""; return "";
} }
if (chbTerminal->get_active() == true) {
if (chbTerminal->get_active() == true){
str_cmd_terminal = "xterm -e "; str_cmd_terminal = "xterm -e ";
} }
else{ else{
str_cmd_terminal = ""; str_cmd_terminal = "";
} }
string cmd = ""; string cmd = "";
if (path_file.length()>0){ if (path_file.length() > 0) {
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " xdg-open '" + path_file + "' "; cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " xdg-open '" + path_file + "' ";
} }
else if (name_app.length()>0){ else if (name_app.length() > 0) {
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + name_app; cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + name_app;
} }
else if (user_cmd.length()>0){ else if (user_cmd.length() > 0) {
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " " + user_cmd; cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " " + user_cmd;
} }
if (cmd.find("-e su ")!=string::npos){ if (cmd.find("-e su ") != string::npos) {
cmd+=" \""; cmd+=" \"";
} }
cmd += " > /dev/null 2>&1"; cmd += " > /dev/null 2>&1";
return cmd; return cmd;
} }
void MainWindow::call_app(string &cmd){ void MainWindow::call_app(string &cmd) {
if (cmd.length() != 0){ if (cmd.length() != 0) {
std::thread t([&](string cmd){system(cmd.c_str());}, cmd); std::thread t([&](string cmd) {system(cmd.c_str());}, cmd);
t.detach(); t.detach();
} }
} }
void MainWindow::denamic_cmd(){ void MainWindow::denamic_cmd() {
if (chbTerminal->get_active()==true || chbAnotherUser->get_active()==true || cbxExecuteEpriority->get_active()==true){ if (chbTerminal->get_active() == true || chbAnotherUser->get_active() == true || cbxExecuteEpriority->get_active() == true) {
if (txtCmd->get_text().length()==0){ if (txtCmd->get_text().length() == 0) {
chbTerminal->set_active(false); chbTerminal->set_active(false);
chbAnotherUser->set_active(false); chbAnotherUser->set_active(false);
cbxExecuteEpriority->set_active(false); cbxExecuteEpriority->set_active(false);
@ -561,94 +550,93 @@ void MainWindow::denamic_cmd(){
} }
} }
else{ else{
if (user_cmd.length() != 0){ if (user_cmd.length() != 0) {
txtCmd->set_text(this->start_cmd(user_cmd)); txtCmd->set_text(this->start_cmd(user_cmd));
} }
else if (path_file.length() != 0){ else if (path_file.length() != 0) {
txtCmd->set_text(this->start_cmd(user_cmd)); txtCmd->set_text(this->start_cmd(user_cmd));
} }
else if (name_app.length() != 0){ else if (name_app.length() != 0) {
txtCmd->set_text(this->start_cmd(user_cmd)); txtCmd->set_text(this->start_cmd(user_cmd));
} }
} }
} }
bool MainWindow::focus_out_txt_cmd(GdkEventFocus* event){ bool MainWindow::focus_out_txt_cmd(GdkEventFocus* event) {
if (cmd_old!=txtCmd->get_text()){ if (cmd_old != txtCmd->get_text()) {
user_cmd = txtCmd->get_text(); user_cmd = txtCmd->get_text();
} }
return true; return true;
} }
void MainWindow::entry_app(){ void MainWindow::entry_app() {
this->denamic_cmd(); this->denamic_cmd();
if (name_app.length()==0 && path_file.length()==0){ if (name_app.length() == 0 && path_file.length() == 0) {
} }
string cmd = txtCmd->get_text(); string cmd = txtCmd->get_text();
this->call_app(cmd); this->call_app(cmd);
} }
void MainWindow::changed_user(){ void MainWindow::changed_user() {
Glib::ustring entry_user = cmbUser->get_active_text(); Glib::ustring entry_user = cmbUser->get_active_text();
if (geteuid()==0 || entry_user == "root"){ if (geteuid() == 0 || entry_user == "root") {
spinPriority->set_range(-20,19); spinPriority->set_range(-20, 19);
spinPriority->set_increments(1.0,-1.0); spinPriority->set_increments(1.0, -1.0);
scalePriority->set_range(-20,19); scalePriority->set_range(-20, 19);
scalePriority->set_value(0); scalePriority->set_value(0);
lblTimeEpriorityLow->set_text("19 (Низкий)"); lblTimeEpriorityLow->set_text("19 (Низкий)");
lblTime4EpriorityHigh->set_text("-20 (Высокий)"); lblTime4EpriorityHigh->set_text("-20 (Высокий)");
} }
else{ else{
spinPriority->set_range(0,19); spinPriority->set_range(0, 19);
spinPriority->set_increments(1.0,-1.0); spinPriority->set_increments(1.0, -1.0);
scalePriority->set_range(0,19); scalePriority->set_range(0, 19);
scalePriority->set_value(0); scalePriority->set_value(0);
lblTimeEpriorityLow->set_text("19 (Низкий)"); lblTimeEpriorityLow->set_text("19 (Низкий)");
lblTime4EpriorityHigh->set_text("0 (Высокий)"); lblTime4EpriorityHigh->set_text("0 (Высокий)");
} }
} }
void MainWindow::activ_or_block_other_user(){ void MainWindow::activ_or_block_other_user() {
bool flag = chbAnotherUser->get_active(); bool flag = chbAnotherUser->get_active();
cmbUser->set_active(0); cmbUser->set_active(0);
cmbUser->set_sensitive(flag); cmbUser->set_sensitive(flag);
lblInfoUserName->set_sensitive(flag); lblInfoUserName->set_sensitive(flag);
if (flag_pkexec == true){ if (flag_pkexec == true) {
rbPkexec->set_sensitive(flag); rbPkexec->set_sensitive(flag);
} }
if (flag_su == true){ if (flag_su == true) {
rbSu->set_sensitive(flag); rbSu->set_sensitive(flag);
} }
if (flag_sudo == true){ if (flag_sudo == true) {
rbSudo->set_sensitive(flag); rbSudo->set_sensitive(flag);
} }
this->denamic_cmd(); this->denamic_cmd();
} }
void MainWindow::change_scale_priority(){ void MainWindow::change_scale_priority() {
scalePriority->set_value(spinPriority->get_value_as_int()); scalePriority->set_value(spinPriority->get_value_as_int());
this->denamic_cmd(); this->denamic_cmd();
} }
void MainWindow::change_spin_priority(){ void MainWindow::change_spin_priority() {
spinPriority->set_value(scalePriority->get_value()); spinPriority->set_value(scalePriority->get_value());
this->denamic_cmd(); this->denamic_cmd();
} }
void MainWindow::pars_dir_bin(){ void MainWindow::pars_dir_bin() {
namespace fs = std::filesystem; namespace fs = std::filesystem;
std::string path = "/bin"; std::string path = "/bin";
string file_name = ""; string file_name = "";
for (const auto & entry : fs::directory_iterator(path)){ for (const auto & entry: fs::directory_iterator(path)) {
file_name = entry.path().filename().string(); file_name = entry.path().filename().string();
if (file_name=="su"){ if (file_name == "su") {
flag_su = true; flag_su = true;
} }
else if (file_name=="sudo"){ else if (file_name == "sudo") {
flag_sudo = true; flag_sudo = true;
} }
else if (file_name=="pkexec"){ else if (file_name == "pkexec") {
flag_pkexec = true; flag_pkexec = true;
} }
} }
@ -657,7 +645,7 @@ void MainWindow::pars_dir_bin(){
rbSudo->set_sensitive(flag_sudo); rbSudo->set_sensitive(flag_sudo);
} }
void MainWindow::pars_users(){ void MainWindow::pars_users() {
while (true) { while (true) {
errno = 0; errno = 0;
passwd* entry = getpwent(); passwd* entry = getpwent();
@ -667,63 +655,62 @@ void MainWindow::pars_users(){
} }
break; break;
} }
if (entry->pw_uid >= 1000 && entry->pw_uid != 65534) {
if (entry->pw_uid >= 1000 && entry->pw_uid!=65534){
cmbUser->append(entry->pw_name); cmbUser->append(entry->pw_name);
} }
} }
cmbUser->append("root"); cmbUser->append("root");
endpwent(); endpwent();
} }
vector<std::string> MainWindow::split(const std::string &s, char delim) { vector<std::string> MainWindow::split(const std::string &s, char delim) {
std::stringstream ss(s); std::stringstream ss(s);
std::string item; std::string item;
std::vector<std::string> elems; std::vector<std::string> elems;
while (std::getline(ss, item, delim)) { while (std::getline(ss, item, delim)) {
elems.push_back(item); elems.push_back(item);
} }
return elems; return elems;
} }
void MainWindow::str_remove(std::string& source, std::string & to_remove){ void MainWindow::str_remove(std::string& source, std::string & to_remove) {
string::size_type n = to_remove.length(); string::size_type n = to_remove.length();
for (string::size_type i = source.find(to_remove); for (string::size_type i = source.find(to_remove);
i != string::npos; i != string::npos;
i = source.find(to_remove)) i = source.find(to_remove))
source.erase(i, n); source.erase(i, n);
} }
void MainWindow::pars_apps(){ void MainWindow::pars_apps() {
if (list_app.size()!=0){return;} if (list_app.size() != 0 ) {return;}
namespace fs = std::filesystem; namespace fs = std::filesystem;
struct struct_App App; struct struct_App App;
string file_name = ""; string file_name = "";
string str_Categories; string str_Categories;
string path = "/usr/share/applications/"; string path = "/usr/share/applications/";
for (const auto & entry : fs::directory_iterator(path)){ for (const auto & entry : fs::directory_iterator(path)) {
file_name = entry.path().filename().string(); file_name = entry.path().filename().string();
path = "/usr/share/applications/"+file_name; path = "/usr/share/applications/"+file_name;
if (file_name.find(".desktop")!=std::string::npos){ if (file_name.find(".desktop") != std::string::npos) {
GKeyFile *gfile=g_key_file_new(); GKeyFile *gfile=g_key_file_new();
g_key_file_load_from_file(gfile,path.c_str(),G_KEY_FILE_KEEP_TRANSLATIONS,NULL); g_key_file_load_from_file(gfile, path.c_str(), G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL); char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", NULL);
char *Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL); char *Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL);
char *Exec=g_key_file_get_string(gfile,"Desktop Entry", "Exec",NULL); char *Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL);
char *Categories=g_key_file_get_locale_string(gfile,"Desktop Entry", "Categories",setlocale(LC_ALL,""),NULL); char *Categories = g_key_file_get_locale_string(gfile, "Desktop Entry", "Categories", setlocale(LC_ALL, ""), NULL);
char *Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL); char *Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL);
char *Mime=g_key_file_get_string(gfile,"Desktop Entry", "MimeType",NULL); char *Mime = g_key_file_get_string(gfile, "Desktop Entry", "MimeType", NULL);
if (Type==NULL) continue; if (Type == NULL) continue;
if (Name==NULL) continue; if (Name == NULL) continue;
if (Exec==NULL) continue; if (Exec == NULL) continue;
if (Categories==NULL) continue; if (Categories == NULL) continue;
if (Icon==NULL) continue; if (Icon == NULL) continue;
str_Categories = Categories; str_Categories = Categories;
App.Name = Name; App.Name = Name;
App.Type = Type; App.Type = Type;
App.Exec = Exec; App.Exec = Exec;
App.Icon = Icon; App.Icon = Icon;
if (Mime!=NULL){ if (Mime != NULL) {
App.MimeType = Mime; App.MimeType = Mime;
} }
else{ else{
@ -731,7 +718,6 @@ void MainWindow::pars_apps(){
} }
App.Name_desktop = file_name; App.Name_desktop = file_name;
App.Categories = split(str_Categories, ';'); App.Categories = split(str_Categories, ';');
} }
list_app.push_back(App); list_app.push_back(App);
} }

@ -19,10 +19,10 @@
using namespace std; using namespace std;
extern string path_app; extern const string path_app;
extern string app_name; extern const string app_name;
extern string path_glade; extern const string path_glade;
extern string path_css; extern const string path_css;
extern int socket_ext_id_I; extern int socket_ext_id_I;
extern int socket_trd_id_I; extern int socket_trd_id_I;
void me_thread(string cmd); void me_thread(string cmd);
@ -91,137 +91,133 @@ public:
void unselect_icon(Gtk::IconView *icon_entry); void unselect_icon(Gtk::IconView *icon_entry);
void str_remove(std::string& source, std::string & to_remove); void str_remove(std::string& source, std::string & to_remove);
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);
public:
class ModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
ModelColumns()
{
add(m_col_filename);
add(m_col_description);
add(m_col_pixbuf);
add(app_name_exec);
add(float_h_align);
add(float_w_align);
add(icon_name);
}
Gtk::TreeModelColumn<std::string> m_col_filename;
Gtk::TreeModelColumn<std::string> icon_name;
Gtk::TreeModelColumn<Glib::ustring> m_col_description;
Gtk::TreeModelColumn<Glib::ustring> app_name_exec;
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_col_pixbuf;
Gtk::TreeModelColumn<float> float_h_align;
Gtk::TreeModelColumn<float> float_w_align;
};
ModelColumns m_Columns;
public:
Glib::RefPtr<Gtk::Builder> builder;
Gtk::Button *btnFilemaneg;
Gtk::Button *btnListApp;
Gtk::Button *btnStart;
Gtk::CheckButton *chbTerminal;
Gtk::CheckButton *chbAnotherUser;
Gtk::CheckButton *cbxExecuteEpriority;
Gtk::ComboBoxText *cmbUser;
Gtk::SpinButton *spinPriority;
Gtk::Scale *scalePriority;
Gtk::RadioButton *rbPkexec;
Gtk::RadioButton *rbSu;
Gtk::RadioButton *rbSudo;
Gtk::Entry *txtCmd;
Gtk::FileChooserDialog *wndChooseFileWallpaper;
Gtk::Button *btnFilemangerExit;
Gtk::Button *btnFilemangerOk;
Gtk::Label *lblTimeEpriority;
Gtk::Label *lblTimeEpriorityLow;
Gtk::Label *lblTime4EpriorityHigh;
Gtk::Label *lblUserName;
Gtk::MessageDialog *messageError;
Gtk::Button *btnMessageErrorOk;
Gtk::Label *lblMessageError;
Gtk::Button *btnStartMenuOK;
Gtk::Button *btnStartMenuExit;
Gtk::Window *dialogStartMenu;
Gtk::Box *boxColor;
Gtk::Label *lblInfoHead;
Gtk::Label *lblinfoCmd;
Gtk::Label *lblInfoTime;
Gtk::Label *labInfoExecutTerm;
Gtk::Label *lblInfoUser;
Gtk::Label *lblInfoUserOther;
Gtk::Label *lblInfoUserName;
Gtk::Label *lblInfoNooPriority;
Gtk::Label *lblInfoExec;
Gtk::Label *lblInfoPriority;
Gtk::Label *lblGraphics;
Gtk::Label *lblTools;
Gtk::Label *lblInternet;
Gtk::Label *lblMultimedia;
Gtk::Label *lblSettings;
Gtk::Label *lblEducation;
Gtk::Label *lblOffice;
Gtk::Label *lblOther;
Gtk::Label *lblDevelopment;
Gtk::Label *lblSystem;
Gtk::Label *lblHeaderName;
Gtk::IconView *iconGraphics;
Gtk::IconView *iconTools;
Gtk::IconView *iconInternet;
Gtk::IconView *iconMultimedia;
Gtk::IconView *iconSettings;
Gtk::IconView *iconEducation;
Gtk::IconView *iconOffice;
Gtk::IconView *iconOther;
Gtk::IconView *iconDevelopment;
Gtk::IconView *iconSystem;
Gtk::IconView *iconEntry;
Gtk::MenuItem *btnAbout;
Gtk::MenuItem *btnSynopsis;
Gtk::AboutDialog *aboutWindows;
Gtk::MenuButton *btnSettings;
Gtk::ButtonBox *btnBoxAboutDialog;
Glib::RefPtr<Gtk::ListStore> list_Graphics;
Glib::RefPtr<Gtk::ListStore> list_Tools;
Glib::RefPtr<Gtk::ListStore> list_Internet;
Glib::RefPtr<Gtk::ListStore> list_Multimedia;
Glib::RefPtr<Gtk::ListStore> list_Settings;
Glib::RefPtr<Gtk::ListStore> list_Education;
Glib::RefPtr<Gtk::ListStore> list_Office;
Glib::RefPtr<Gtk::ListStore> list_Other;
Glib::RefPtr<Gtk::ListStore> list_Development;
Glib::RefPtr<Gtk::ListStore> list_System;
public: public:
string version_application = "1.0"; class ModelColumns : public Gtk::TreeModel::ColumnRecord {
string cmd_old = ""; public:
string user_cmd=""; ModelColumns()
string user_cmd_old=""; {
string name_app_old=""; add(m_col_filename);
string path_file_old=""; add(m_col_description);
string execute_cmd = ""; add(m_col_pixbuf);
string path_file = ""; add(app_name_exec);
string name_app = ""; add(float_h_align);
bool flag_pkexec = false; add(float_w_align);
bool flag_su = false; add(icon_name);
bool flag_sudo = false;
string path_file_name; }
struct struct_App{ Gtk::TreeModelColumn<std::string> m_col_filename;
string Name_desktop; Gtk::TreeModelColumn<std::string> icon_name;
string Name; Gtk::TreeModelColumn<Glib::ustring> m_col_description;
string Exec; Gtk::TreeModelColumn<Glib::ustring> app_name_exec;
string Icon; Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_col_pixbuf;
string MimeType; Gtk::TreeModelColumn<float> float_h_align;
string Type; Gtk::TreeModelColumn<float> float_w_align;
vector<std::string> Categories;}; };
list <struct_App> list_app; ModelColumns m_Columns;
set <string> set_categories; public:
int index_exec_gui_apps = 0; Glib::RefPtr<Gtk::Builder> builder;
Gtk::IconView* array_icon[10]; Gtk::Button *btnFilemaneg;
Gtk::Button *btnListApp;
Gtk::Button *btnStart;
Gtk::CheckButton *chbTerminal;
Gtk::CheckButton *chbAnotherUser;
Gtk::CheckButton *cbxExecuteEpriority;
Gtk::ComboBoxText *cmbUser;
Gtk::SpinButton *spinPriority;
Gtk::Scale *scalePriority;
Gtk::RadioButton *rbPkexec;
Gtk::RadioButton *rbSu;
Gtk::RadioButton *rbSudo;
Gtk::Entry *txtCmd;
Gtk::FileChooserDialog *wndChooseFileWallpaper;
Gtk::Button *btnFilemangerExit;
Gtk::Button *btnFilemangerOk;
Gtk::Label *lblTimeEpriority;
Gtk::Label *lblTimeEpriorityLow;
Gtk::Label *lblTime4EpriorityHigh;
Gtk::Label *lblUserName;
Gtk::MessageDialog *messageError;
Gtk::Button *btnMessageErrorOk;
Gtk::Label *lblMessageError;
Gtk::Button *btnStartMenuOK;
Gtk::Button *btnStartMenuExit;
Gtk::Window *dialogStartMenu;
Gtk::Box *boxColor;
Gtk::Label *lblInfoHead;
Gtk::Label *lblinfoCmd;
Gtk::Label *lblInfoTime;
Gtk::Label *labInfoExecutTerm;
Gtk::Label *lblInfoUser;
Gtk::Label *lblInfoUserOther;
Gtk::Label *lblInfoUserName;
Gtk::Label *lblInfoNooPriority;
Gtk::Label *lblInfoExec;
Gtk::Label *lblInfoPriority;
Gtk::Label *lblGraphics;
Gtk::Label *lblTools;
Gtk::Label *lblInternet;
Gtk::Label *lblMultimedia;
Gtk::Label *lblSettings;
Gtk::Label *lblEducation;
Gtk::Label *lblOffice;
Gtk::Label *lblOther;
Gtk::Label *lblDevelopment;
Gtk::Label *lblSystem;
Gtk::Label *lblHeaderName;
Gtk::IconView *iconGraphics;
Gtk::IconView *iconTools;
Gtk::IconView *iconInternet;
Gtk::IconView *iconMultimedia;
Gtk::IconView *iconSettings;
Gtk::IconView *iconEducation;
Gtk::IconView *iconOffice;
Gtk::IconView *iconOther;
Gtk::IconView *iconDevelopment;
Gtk::IconView *iconSystem;
Gtk::IconView *iconEntry;
Gtk::MenuItem *btnAbout;
Gtk::MenuItem *btnSynopsis;
Gtk::AboutDialog *aboutWindows;
Gtk::MenuButton *btnSettings;
Gtk::ButtonBox *btnBoxAboutDialog;
Glib::RefPtr<Gtk::ListStore> list_Graphics;
Glib::RefPtr<Gtk::ListStore> list_Tools;
Glib::RefPtr<Gtk::ListStore> list_Internet;
Glib::RefPtr<Gtk::ListStore> list_Multimedia;
Glib::RefPtr<Gtk::ListStore> list_Settings;
Glib::RefPtr<Gtk::ListStore> list_Education;
Glib::RefPtr<Gtk::ListStore> list_Office;
Glib::RefPtr<Gtk::ListStore> list_Other;
Glib::RefPtr<Gtk::ListStore> list_Development;
Glib::RefPtr<Gtk::ListStore> list_System;
public:
string version_application = "1.0";
string cmd_old = "";
string user_cmd = "";
string user_cmd_old = "";
string name_app_old = "";
string path_file_old = "";
string execute_cmd = "";
string path_file = "";
string name_app = "";
bool flag_pkexec = false;
bool flag_su = false;
bool flag_sudo = false;
string path_file_name;
struct struct_App {
string Name_desktop;
string Name;
string Exec;
string Icon;
string MimeType;
string Type;
vector<std::string> Categories;
};
list <struct_App> list_app;
set <string> set_categories;
int index_exec_gui_apps = 0;
Gtk::IconView* array_icon[10];
}; };
class SettingsPlug : public Gtk::Plug{ class SettingsPlug : public Gtk::Plug{

Loading…
Cancel
Save