|
|
|
@ -1,9 +1,9 @@
|
|
|
|
#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)
|
|
|
|
@ -12,17 +12,14 @@ CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_descr
|
|
|
|
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);
|
|
|
|
@ -106,6 +103,7 @@ void MainWindow::get_builder(){
|
|
|
|
builder->get_widget("aboutWindows", aboutWindows);
|
|
|
|
builder->get_widget("aboutWindows", aboutWindows);
|
|
|
|
builder->get_widget("btnSettings", btnSettings);
|
|
|
|
builder->get_widget("btnSettings", btnSettings);
|
|
|
|
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
|
|
|
|
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
|
|
|
|
|
|
|
|
builder->get_widget("boxAbout",boxAbout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_icon_array() {
|
|
|
|
void MainWindow::set_icon_array() {
|
|
|
|
@ -208,6 +206,7 @@ void MainWindow::event(){
|
|
|
|
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) {
|
|
|
|
void MainWindow::delete_cmd(const int &x, const int &y) {
|
|
|
|
if (y > 1) {
|
|
|
|
if (y > 1) {
|
|
|
|
chbTerminal->set_active(false);
|
|
|
|
chbTerminal->set_active(false);
|
|
|
|
@ -219,13 +218,10 @@ 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,7 +230,6 @@ 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 &");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -289,8 +284,7 @@ void MainWindow::select_System(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> >k_list) {
|
|
|
|
void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> >k_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();
|
|
|
|
@ -348,12 +342,10 @@ void MainWindow::settings(){
|
|
|
|
rbSu->set_sensitive(false);
|
|
|
|
rbSu->set_sensitive(false);
|
|
|
|
rbSudo->set_sensitive(false);
|
|
|
|
rbSudo->set_sensitive(false);
|
|
|
|
btnBoxAboutDialog->set_visible(false);
|
|
|
|
btnBoxAboutDialog->set_visible(false);
|
|
|
|
Gtk::Widget *boxAbout;
|
|
|
|
|
|
|
|
builder->get_widget("boxAbout",boxAbout);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ubl_make_plugs(boxAbout,boxAbout, 0, socket_trd_id_I);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ubl_make_plugs(boxAbout, boxAbout, socket_ext_id_I, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::close_entry_app() {
|
|
|
|
void MainWindow::close_entry_app() {
|
|
|
|
this->icon_clear();
|
|
|
|
this->icon_clear();
|
|
|
|
dialogStartMenu->hide();
|
|
|
|
dialogStartMenu->hide();
|
|
|
|
@ -481,7 +473,6 @@ string MainWindow::start_cmd(string user_cmd){
|
|
|
|
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()) + " ";
|
|
|
|
@ -503,6 +494,7 @@ string MainWindow::start_cmd(string user_cmd){
|
|
|
|
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)) {
|
|
|
|
@ -512,14 +504,12 @@ string MainWindow::start_cmd(string user_cmd){
|
|
|
|
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 + "' ";
|
|
|
|
@ -534,7 +524,6 @@ string MainWindow::start_cmd(string user_cmd){
|
|
|
|
cmd+=" \"";
|
|
|
|
cmd+=" \"";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmd += " > /dev/null 2>&1";
|
|
|
|
cmd += " > /dev/null 2>&1";
|
|
|
|
|
|
|
|
|
|
|
|
return cmd;
|
|
|
|
return cmd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -583,7 +572,6 @@ bool MainWindow::focus_out_txt_cmd(GdkEventFocus* event){
|
|
|
|
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);
|
|
|
|
@ -667,7 +655,6 @@ 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|