|
|
|
|
@ -106,7 +106,10 @@ void MainWindow::get_builder(){
|
|
|
|
|
builder->get_widget("lblOffice", lblOffice);
|
|
|
|
|
builder->get_widget("lblOther", lblOther);
|
|
|
|
|
builder->get_widget("lblDevelopment", lblDevelopment);
|
|
|
|
|
|
|
|
|
|
builder->get_widget("lblSystem", lblSystem);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
builder->get_widget("iconGraphics", iconGraphics);
|
|
|
|
|
builder->get_widget("iconTools", iconTools);
|
|
|
|
|
builder->get_widget("iconInternet", iconInternet);
|
|
|
|
|
@ -117,17 +120,8 @@ void MainWindow::get_builder(){
|
|
|
|
|
builder->get_widget("iconOther", iconOther);
|
|
|
|
|
builder->get_widget("iconDevelopment", iconDevelopment);
|
|
|
|
|
builder->get_widget("iconSystem", iconSystem);
|
|
|
|
|
|
|
|
|
|
builder->get_widget("liststoreGraphics", liststoreGraphics);
|
|
|
|
|
builder->get_widget("liststoreTools", liststoreTools);
|
|
|
|
|
builder->get_widget("liststoreInternet", liststoreInternet);
|
|
|
|
|
builder->get_widget("liststoreMultimedia", liststoreMultimedia);
|
|
|
|
|
builder->get_widget("liststoreSettings", liststoreSettings);
|
|
|
|
|
builder->get_widget("liststoreEducation", liststoreEducation);
|
|
|
|
|
builder->get_widget("liststoreOffice", liststoreOffice);
|
|
|
|
|
builder->get_widget("liststoreOther", liststoreOther);
|
|
|
|
|
builder->get_widget("liststoreDevelopment", liststoreDevelopment);
|
|
|
|
|
builder->get_widget("liststoreSystem", liststoreSystem);
|
|
|
|
|
*/
|
|
|
|
|
builder->get_widget("treeViewGraphics", treeViewGraphics);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -137,8 +131,10 @@ void MainWindow::add_CSS(){
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> styleContext = Gtk::StyleContext::create();
|
|
|
|
|
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();//get default screen
|
|
|
|
|
styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context = boxColor->get_style_context();
|
|
|
|
|
context->add_class("cssboxColor1");
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context_box = boxColor->get_style_context();
|
|
|
|
|
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblInfoHead->get_style_context();
|
|
|
|
|
context_box->add_class("cssboxColor1");
|
|
|
|
|
context_lbl_head->add_class("textHead");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::localization(){
|
|
|
|
|
@ -146,7 +142,7 @@ void MainWindow::localization(){
|
|
|
|
|
btnStart->set_label(gettext("Run"));
|
|
|
|
|
wndChooseFileWallpaper->set_title(gettext("Please select File"));
|
|
|
|
|
dialogStartMenu->set_title(gettext("Warning!"));
|
|
|
|
|
lblInfoHead->set_text(gettext("Running applications as a user with a specified priority"));
|
|
|
|
|
lblInfoHead->set_text(gettext("Running applications as a user with a\n specified priority"));
|
|
|
|
|
lblinfoCmd->set_text(gettext("Command Line"));
|
|
|
|
|
lblInfoTime->set_text(gettext("Team:"));
|
|
|
|
|
labInfoExecutTerm->set_text(gettext("Run in the terminal emulator"));
|
|
|
|
|
@ -154,7 +150,7 @@ void MainWindow::localization(){
|
|
|
|
|
lblInfoUserOther->set_text(gettext("Run as another user"));
|
|
|
|
|
lblInfoUserName->set_text(gettext("User Name:"));
|
|
|
|
|
lblInfoNooPriority->set_text(gettext("Priority:"));
|
|
|
|
|
lblInfoExec->set_text(gettext("Run with a different priority"));
|
|
|
|
|
lblInfoExec->set_text(gettext("Change startup priority"));
|
|
|
|
|
lblInfoPriority->set_text(gettext("Priority:"));
|
|
|
|
|
lblMessageError->set_text(gettext("Select an executable file or program"));
|
|
|
|
|
lblInfoEnterProg->set_text(gettext("Selecting Programs"));
|
|
|
|
|
@ -203,7 +199,12 @@ void MainWindow::settings(){
|
|
|
|
|
this->pars_dir_bin();
|
|
|
|
|
this->pars_users();
|
|
|
|
|
this->activ_or_block_execute_epriority();
|
|
|
|
|
this->activ_or_block_other_user();
|
|
|
|
|
cmbUser->set_active(0);
|
|
|
|
|
cmbUser->set_sensitive(false);
|
|
|
|
|
lblInfoUserName->set_sensitive(false);
|
|
|
|
|
rbPkexec->set_sensitive(false);
|
|
|
|
|
rbSu->set_sensitive(false);
|
|
|
|
|
rbSudo->set_sensitive(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::close_start_menu(){
|
|
|
|
|
@ -232,10 +233,10 @@ void MainWindow::close_filemaneg(){
|
|
|
|
|
wndChooseFileWallpaper->hide();
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::get_path_filemaneg(){
|
|
|
|
|
path_file_name = wndChooseFileWallpaper->get_filename();
|
|
|
|
|
if (path_file_name.length()==0){}
|
|
|
|
|
path_file = wndChooseFileWallpaper->get_filename();
|
|
|
|
|
if (path_file.length()==0){}
|
|
|
|
|
else{
|
|
|
|
|
txtCmd->set_text(path_file_name);
|
|
|
|
|
txtCmd->set_text(path_file);
|
|
|
|
|
this->close_filemaneg();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -243,11 +244,11 @@ void MainWindow::open_list_app(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//liststoreDevelopment = iconDevelopment->get_model();
|
|
|
|
|
|
|
|
|
|
string path = "";
|
|
|
|
|
for ( const auto &str_app : list_app){
|
|
|
|
|
for ( const auto &str_categor : str_app.Categories){
|
|
|
|
|
path = "/usr/share/applications/" + str_app.Icon + ".svg";
|
|
|
|
|
if (str_categor=="Graphics"){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (str_categor=="Tools"){
|
|
|
|
|
|
|
|
|
|
@ -300,30 +301,16 @@ void MainWindow::start_cmd(){
|
|
|
|
|
//=========================================
|
|
|
|
|
if (chbAnotherUser->get_active()){
|
|
|
|
|
if (rbPkexec->get_active()){
|
|
|
|
|
if (geteuid()!=0){
|
|
|
|
|
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
|
|
|
|
|
str_variants_root = "pcexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
|
|
|
|
|
}
|
|
|
|
|
else if (chbAnotherUser->get_active()){
|
|
|
|
|
str_variants_root = "pcexec --user " + cmbUser->get_active_text() + " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
str_variants_root = "pcexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if ((chbAnotherUser->get_active()) && (cmbUser->get_active_text().length()==0)) {
|
|
|
|
|
str_variants_root = "pkexec env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
|
|
|
|
|
}
|
|
|
|
|
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 ";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (rbSu->get_active()){
|
|
|
|
|
if (geteuid()!=0){
|
|
|
|
|
chbTerminal->set_active(true);
|
|
|
|
|
@ -356,6 +343,7 @@ void MainWindow::start_cmd(){
|
|
|
|
|
if (cbxExecuteEpriority->get_active()){
|
|
|
|
|
str_nice_cmd = "nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//=========================================
|
|
|
|
|
|
|
|
|
|
string user_cmd = txtCmd->get_text();
|
|
|
|
|
@ -371,12 +359,18 @@ void MainWindow::start_cmd(){
|
|
|
|
|
str_cmd_terminal="";
|
|
|
|
|
}
|
|
|
|
|
string cmd = "";
|
|
|
|
|
cmd = "nohup " + str_cmd_terminal + str_variants_root + str_nice_cmd + user_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 + " &";
|
|
|
|
|
}
|
|
|
|
|
txtCmd->set_text(cmd);
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
|
|
|
|
|
path_file_name="";
|
|
|
|
|
}
|
|
|
|
|
path_file="";
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::changed_user(){
|
|
|
|
|
Glib::ustring entry_user = cmbUser->get_active_text();
|
|
|
|
|
if (geteuid()==0 || entry_user == "root"){
|
|
|
|
|
@ -400,6 +394,7 @@ void MainWindow::changed_user(){
|
|
|
|
|
//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);
|
|
|
|
|
@ -489,6 +484,7 @@ void MainWindow::pars_apps(){
|
|
|
|
|
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 *Icon=g_key_file_get_string(gfile,"Desktop Entry", "Icon",NULL);
|
|
|
|
|
char *Mime=g_key_file_get_string(gfile,"Desktop Entry", "MimeType",NULL);
|
|
|
|
|
if (Type==NULL) continue;
|
|
|
|
|
if (Name==NULL) continue;
|
|
|
|
|
if (Exec==NULL) continue;
|
|
|
|
|
@ -499,6 +495,13 @@ void MainWindow::pars_apps(){
|
|
|
|
|
App.Type = Type;
|
|
|
|
|
App.Exec = Exec;
|
|
|
|
|
App.Icon = Name;
|
|
|
|
|
if (Mime!=NULL){
|
|
|
|
|
App.MimeType = Mime;
|
|
|
|
|
cout << App.MimeType << endl;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
App.MimeType = "";
|
|
|
|
|
}
|
|
|
|
|
App.Name_desktop = file_name;
|
|
|
|
|
App.Categories = split(str_Categories, ';');
|
|
|
|
|
for ( const auto &text : App.Categories){
|
|
|
|
|
|