diff --git a/bg_top.png b/bg_top.png index d673a36..8eb67cb 100644 Binary files a/bg_top.png and b/bg_top.png differ diff --git a/source/ublexec.cc b/source/ublexec.cc index 498d29d..4bc505a 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -106,22 +106,20 @@ void MainWindow::get_builder(){ builder->get_widget("lblOffice", lblOffice); builder->get_widget("lblOther", lblOther); builder->get_widget("lblDevelopment", lblDevelopment); + builder->get_widget("iconGraphics", iconGraphics); builder->get_widget("lblSystem", lblSystem); - /* - builder->get_widget("iconGraphics", iconGraphics); - builder->get_widget("iconTools", iconTools); - builder->get_widget("iconInternet", iconInternet); - builder->get_widget("iconMultimedia", iconMultimedia); - builder->get_widget("iconSettings", iconSettings); - builder->get_widget("iconEducation", iconEducation); - builder->get_widget("iconOffice", iconOffice); - builder->get_widget("iconOther", iconOther); - builder->get_widget("iconDevelopment", iconDevelopment); - builder->get_widget("iconSystem", iconSystem); - */ - builder->get_widget("treeViewGraphics", treeViewGraphics); + + + list_Graphics = Gtk::ListStore::create( m_Columns ); + list_Graphics->set_sort_column( m_Columns.m_col_description, Gtk::SORT_ASCENDING ); + + iconGraphics->set_model(list_Graphics); + iconGraphics->set_markup_column(m_Columns.m_col_description); + iconGraphics->set_pixbuf_column(m_Columns.m_col_pixbuf); + + } @@ -249,6 +247,9 @@ void MainWindow::open_list_app(){ for ( const auto &str_categor : str_app.Categories){ path = "/usr/share/applications/" + str_app.Icon + ".svg"; if (str_categor=="Graphics"){ + Gtk::TreeModel::Row row = *(list_Graphics->append()); + row[m_Columns.m_col_filename] = path; + row[m_Columns.m_col_description] = str_app.Name; } else if (str_categor=="Tools"){ @@ -280,41 +281,51 @@ void MainWindow::open_list_app(){ } } - /* - for (const auto & str_categor : set_categories){ - Gtk::Label* Label1 = new Gtk::Label(str_categor); - Gtk::IconView* icon = new Gtk::IconView(); - boxlistProgramm->pack_start(*icon); - boxlistProgramm->pack_start(*Label1); - - }*/ - - dialogStartMenu->show_all(); } +/* +void MainWindow::tmp_desktop(string cmd_name){ + string desktop = ""; + desktop = "[Desktop Entry]\nEncoding=UTF-8\nName=test\nName[ru]=тест\nGenericName=test\nGenericName[ru]=тест\nComment=test\nComment[ru]=test\nType=Application\nExec=pkexec "+cmd_name + + "\nIcon=ublexec\nTerminal=false\nCategories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;"; + string cmd = ""; + cmd = "touch /tmp/" + cmd_name + ".desktop; echo \"" + desktop + "\" > /tmp/"+cmd_name+".desktop; chmod +x /tmp/"+cmd_name+".desktop"; + cout << cmd << endl; + system(cmd.c_str()); +} +*/ + void MainWindow::start_cmd(){ //txtCmd->set_text(""); string str_cmd_terminal=""; string str_variants_root = ""; string str_nice_cmd = ""; + string user_cmd = ""; + user_cmd = txtCmd->get_text(); //========================================= if (chbAnotherUser->get_active()){ + if (geteuid()!=0){ + chbTerminal->set_active(true); + } if (rbPkexec->get_active()){ + if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + //this->tmp_desktop(user_cmd); + } else if (chbAnotherUser->get_active()){ str_variants_root = "pkexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + } else{ str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY "; + //this->tmp_desktop(user_cmd); + //user_cmd = "/tmp/" + user_cmd + ".desktop"; } } else if (rbSu->get_active()){ - if (geteuid()!=0){ - chbTerminal->set_active(true); - } if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { str_variants_root="su "; } @@ -326,9 +337,6 @@ void MainWindow::start_cmd(){ } } else if (rbSudo->get_active()){ - if (geteuid()!=0){ - chbTerminal->set_active(true); - } if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) { str_variants_root="sudo "; } @@ -346,7 +354,6 @@ void MainWindow::start_cmd(){ //========================================= - string user_cmd = txtCmd->get_text(); //========================================= if (user_cmd.length()==0){ messageError->show(); @@ -360,10 +367,12 @@ void MainWindow::start_cmd(){ } string cmd = ""; if (path_file!=""){ + cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + " xdg-open '" + user_cmd + "' &"; } else{ - cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd + " &"; + + cmd = "" + str_cmd_terminal + str_variants_root + str_nice_cmd + user_cmd + " &"; } txtCmd->set_text(cmd); system(cmd.c_str()); diff --git a/source/ublexec.h b/source/ublexec.h index d87a70f..f631439 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -85,21 +85,27 @@ public: void pars_dir_bin(); void pars_users(); void pars_apps(); + void tmp_desktop(string cmd_name); vector split(const std::string &s, char delim); public: - class ModelColumns : public Gtk::TreeModel::ColumnRecord + class ModelColumns : public Gtk::TreeModel::ColumnRecord { public: ModelColumns() - { add(m_col_id); add(m_col_name); } - - Gtk::TreeModelColumn m_col_id; - Gtk::TreeModelColumn m_col_name; + { + add(m_col_filename); + add(m_col_description); + add(m_col_pixbuf); + } + + Gtk::TreeModelColumn m_col_filename; + Gtk::TreeModelColumn m_col_description; + Gtk::TreeModelColumn > m_col_pixbuf; }; - ModelColumns m_Columns; + ModelColumns m_Columns; public: Glib::RefPtr builder; Gtk::Button *btnFilemaneg; @@ -152,12 +158,10 @@ public: Gtk::Label *lblOther; Gtk::Label *lblDevelopment; Gtk::Label *lblSystem; + Gtk::IconView *iconGraphics; - - Gtk::TreeView *treeViewGraphics=0; - Glib::RefPtr tree_store; - Glib::RefPtr m_refTreeModel; + Glib::RefPtr list_Graphics; diff --git a/ublexec.glade b/ublexec.glade index 717eb2f..5da0d4d 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -10,7 +10,7 @@ 250 - 470 + 250 False dialog @@ -107,19 +107,10 @@ - + True True - in - - - True - True - - - - - + 6 False @@ -148,18 +139,11 @@ - + True True - in - - - True - True - - - - + + @@ -189,18 +173,11 @@ - + True True - in - - - True - True - - - - + + @@ -230,18 +207,11 @@ - + True True - in - - - True - True - - - - + + @@ -271,18 +241,11 @@ - + True True - in - - - True - True - - - - + + @@ -312,18 +275,11 @@ - + True True - in - - - True - True - - - - + + @@ -353,18 +309,11 @@ - + True True - in - - - True - True - - - - + + @@ -394,18 +343,11 @@ - + True True - in - - - True - True - - - - + + @@ -435,18 +377,11 @@ - + True True - in - - - True - True - - - - + + @@ -476,18 +411,11 @@ - + True True - in - - - True - True - - - - + + @@ -583,9 +511,9 @@ Запуск приложений от имени пользователя с указанным приоритетом - + - + @@ -675,6 +603,7 @@ True True True + end 5 5 6 @@ -706,6 +635,7 @@ True True True + end 5 5 5 @@ -1106,6 +1036,7 @@ adjustment1 20 0 + 0 True