Исправлено окно о программе

pull/13/head
Igor Belitskiy 3 years ago
parent aaea04c259
commit 85b6407174

@ -103,7 +103,8 @@ 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); builder->get_widget("boxAbout", boxAbout);
builder->get_widget("cmbTerminal", cmbTerminal);
} }
void MainWindow::set_icon_array() { void MainWindow::set_icon_array() {
@ -176,13 +177,14 @@ void MainWindow::localization() {
lblOther->set_text(_("Other")); lblOther->set_text(_("Other"));
lblDevelopment->set_text(_("Development")); lblDevelopment->set_text(_("Development"));
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));
chbTerminal->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd)); chbTerminal->signal_toggled().connect([&]() {cmbTerminal->set_sensitive(chbTerminal->get_active());this->denamic_cmd();});
chbAnotherUser->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::activ_or_block_other_user)); chbAnotherUser->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::activ_or_block_other_user));
spinPriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_scale_priority)); spinPriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_scale_priority));
scalePriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_spin_priority)); scalePriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_spin_priority));
@ -214,6 +216,7 @@ void MainWindow::event() {
rbPkexec->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::sudo_nice)); rbPkexec->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::sudo_nice));
} }
void MainWindow::sudo_nice(){ void MainWindow::sudo_nice(){
if (geteuid() == 0 || cmbUser->get_active_text() == "root"){ if (geteuid() == 0 || cmbUser->get_active_text() == "root"){
spinPriority->set_range(-20, 19); spinPriority->set_range(-20, 19);
@ -396,6 +399,7 @@ void MainWindow::settings() {
lblTime4EpriorityHigh->set_text("0 (Высокий)"); lblTime4EpriorityHigh->set_text("0 (Высокий)");
scalePriority->set_inverted(true); scalePriority->set_inverted(true);
this->pars_dir_bin(); this->pars_dir_bin();
this->pars_dir_terminal();
this->is_user_wheel(); this->is_user_wheel();
this->pars_users(); this->pars_users();
this->activ_or_block_execute_epriority(); this->activ_or_block_execute_epriority();
@ -407,6 +411,7 @@ 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);
cmbTerminal->set_sensitive(false);
ubl_make_plugs(boxAbout, boxAbout, socket_ext_id_I, 0); ubl_make_plugs(boxAbout, boxAbout, socket_ext_id_I, 0);
} }
@ -596,7 +601,25 @@ string MainWindow::start_cmd(string user_cmd) {
return ""; return "";
} }
if (chbTerminal->get_active() == true) { if (chbTerminal->get_active() == true) {
str_cmd_terminal = "xterm -e "; string name_terminal = cmbTerminal->get_active_text();
if (name_terminal.length() != 0){
if (name_terminal == "xfce4-terminal") {
str_cmd_terminal = "xfce4-terminal -x ";
}
else if (name_terminal == "konsole") {
str_cmd_terminal = "konsole -e ";
}
else if (name_terminal == "xterm") {
str_cmd_terminal = "xterm -e ";
}
else{
str_cmd_terminal = "";
}
}
else{
str_cmd_terminal = "";
}
} }
else{ else{
str_cmd_terminal = ""; str_cmd_terminal = "";
@ -611,7 +634,7 @@ string MainWindow::start_cmd(string user_cmd) {
else if (user_cmd.length() > 0) { else if (user_cmd.length() > 0) {
cmd = str_nice_cmd + str_cmd_terminal + str_variants_root + " " + user_cmd; cmd = 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.find("-x su ") != string::npos)) {
cmd+=" \""; cmd+=" \"";
} }
cmd = "nohup " + cmd; cmd = "nohup " + cmd;
@ -737,6 +760,26 @@ void MainWindow::pars_dir_bin() {
rbSudo->set_sensitive(flag_sudo); rbSudo->set_sensitive(flag_sudo);
} }
void MainWindow::pars_dir_terminal() {
namespace fs = std::filesystem;
std::string path = "/bin";
string file_name = "";
for (const auto & entry: fs::directory_iterator(path)) {
file_name = entry.path().filename().string();
if (file_name == "konsole") {
cmbTerminal->append("konsole");
cmbTerminal->set_active_text("konsole");
}
else if (file_name == "xfce4-terminal") {
cmbTerminal->append("xfce4-terminal");
cmbTerminal->set_active_text("xfce4-terminal");
}
else if (file_name == "xterm") {
cmbTerminal->append("xterm");
}
}
}
void MainWindow::is_user_wheel(){ void MainWindow::is_user_wheel(){
string response = this->call("id -Gn"); string response = this->call("id -Gn");
if (response.find("wheel") == string::npos){ if (response.find("wheel") == string::npos){

@ -92,6 +92,7 @@ public:
bool focus_out_txt_cmd(GdkEventFocus* event); bool focus_out_txt_cmd(GdkEventFocus* event);
bool focus_in_txt_cmd(GdkEventFocus* event); bool focus_in_txt_cmd(GdkEventFocus* event);
void unselect_icon(Gtk::IconView *icon_entry); void unselect_icon(Gtk::IconView *icon_entry);
void pars_dir_terminal();
void str_remove(std::string& source, std::string & to_remove); void str_remove(std::string& source, std::string & to_remove);
string call(string cmd); string call(string cmd);
vector<std::string> split(const std::string &s, char delim); vector<std::string> split(const std::string &s, char delim);
@ -184,6 +185,7 @@ public:
Gtk::AboutDialog *aboutWindows; Gtk::AboutDialog *aboutWindows;
Gtk::MenuButton *btnSettings; Gtk::MenuButton *btnSettings;
Gtk::ButtonBox *btnBoxAboutDialog; Gtk::ButtonBox *btnBoxAboutDialog;
Gtk::ComboBoxText *cmbTerminal;
Glib::RefPtr<Gtk::ListStore> list_Graphics; Glib::RefPtr<Gtk::ListStore> list_Graphics;
Glib::RefPtr<Gtk::ListStore> list_Tools; Glib::RefPtr<Gtk::ListStore> list_Tools;
Glib::RefPtr<Gtk::ListStore> list_Internet; Glib::RefPtr<Gtk::ListStore> list_Internet;

@ -1080,6 +1080,7 @@ specified priority</property>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkFrame" id="frame1"> <object class="GtkFrame" id="frame1">
@ -1100,14 +1101,16 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<child> <child>
<object class="GtkLabel" id="lblInfoTime"> <object class="GtkLabel" id="lblInfoTime">
<property name="width-request">145</property> <property name="width-request">123</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -1225,9 +1228,10 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-top">6</property> <property name="margin-top">6</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="hexpand">True</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="width-request">131</property> <property name="width-request">110</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">15</property> <property name="margin-left">15</property>
@ -1268,6 +1272,22 @@ specified priority</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkComboBoxText" id="cmbTerminal">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
<property name="margin-right">5</property>
<property name="margin-end">5</property>
<property name="margin-bottom">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
@ -1304,6 +1324,7 @@ specified priority</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkFrame" id="frame2"> <object class="GtkFrame" id="frame2">
@ -1322,11 +1343,13 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<child> <child>
<object class="GtkCheckButton" id="chbAnotherUser"> <object class="GtkCheckButton" id="chbAnotherUser">
<property name="visible">True</property> <property name="visible">True</property>
@ -1428,9 +1451,10 @@ specified priority</property>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<child> <child>
<object class="GtkLabel" id="lblInfoUserName"> <object class="GtkLabel" id="lblInfoUserName">
<property name="width-request">145</property> <property name="width-request">123</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
@ -1516,6 +1540,7 @@ specified priority</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkFrame" id="frame3"> <object class="GtkFrame" id="frame3">
@ -1534,6 +1559,7 @@ specified priority</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property> <property name="margin-left">5</property>
<property name="margin-start">5</property> <property name="margin-start">5</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkCheckButton" id="cbxExecuteEpriority"> <object class="GtkCheckButton" id="cbxExecuteEpriority">
@ -1567,6 +1593,7 @@ specified priority</property>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">True</property>
<child> <child>
<object class="GtkLabel" id="lblInfoPriority"> <object class="GtkLabel" id="lblInfoPriority">
<property name="width-request">5</property> <property name="width-request">5</property>
@ -1639,9 +1666,10 @@ specified priority</property>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="hexpand">False</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="width-request">65</property> <property name="width-request">62</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">15</property> <property name="margin-left">15</property>
@ -1701,7 +1729,7 @@ specified priority</property>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="width-request">95</property> <property name="width-request">107</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="halign">end</property> <property name="halign">end</property>

Loading…
Cancel
Save