|
|
|
|
@ -35,7 +35,6 @@ using namespace std;
|
|
|
|
|
string path_app= "/usr/bin/";
|
|
|
|
|
string path_glade= "/usr/share/ublexec/ui/ublexec.glade";
|
|
|
|
|
string path_css = "/usr/share/ublexec/css/style.css";
|
|
|
|
|
//string path_app = "/home/superadmin/Документы/Проект/ubconfig_new/ubcall/";
|
|
|
|
|
string app_name = "ublexec";
|
|
|
|
|
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} {
|
|
|
|
|
@ -49,18 +48,18 @@ CmdArgParser::CmdArgParser(const std::string& p_name, const std::string& p_descr
|
|
|
|
|
::Window CmdArgParser::GetSocketID() const{
|
|
|
|
|
return m_socketID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder)
|
|
|
|
|
: Gtk::ApplicationWindow(obj), builder{builder} {
|
|
|
|
|
this->builder = builder;
|
|
|
|
|
this->settings();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(Glib::RefPtr<Gtk::Builder> const& builder) {
|
|
|
|
|
this->builder = builder;
|
|
|
|
|
this->settings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_builder(){
|
|
|
|
|
builder->get_widget("btnFilemaneg", btnFilemaneg);
|
|
|
|
|
builder->get_widget("btnListApp", btnListApp);
|
|
|
|
|
@ -80,7 +79,6 @@ void MainWindow::get_builder(){
|
|
|
|
|
builder->get_widget("btnFilemangerOk", btnFilemangerOk);
|
|
|
|
|
builder->get_widget("lblTimeEpriorityLow", lblTimeEpriorityLow);
|
|
|
|
|
builder->get_widget("lblTime4EpriorityHigh", lblTime4EpriorityHigh);
|
|
|
|
|
//builder->get_widget("lblUserName", lblUserName);
|
|
|
|
|
builder->get_widget("messageError", messageError);
|
|
|
|
|
builder->get_widget("lblMessageError", lblMessageError);
|
|
|
|
|
builder->get_widget("btnMessageErrorOk", btnMessageErrorOk);
|
|
|
|
|
@ -121,12 +119,8 @@ void MainWindow::get_builder(){
|
|
|
|
|
builder->get_widget("iconDevelopment", iconDevelopment);
|
|
|
|
|
builder->get_widget("iconSystem", iconSystem);
|
|
|
|
|
builder->get_widget("lblSystem", lblSystem);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::set_icon_array(){
|
|
|
|
|
array_icon[0]=this->iconGraphics;
|
|
|
|
|
array_icon[1]=this->iconTools;
|
|
|
|
|
@ -217,8 +211,6 @@ void MainWindow::event(){
|
|
|
|
|
iconOther->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Other));
|
|
|
|
|
iconDevelopment->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Development));
|
|
|
|
|
iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::icon_clear(){
|
|
|
|
|
@ -271,8 +263,6 @@ void MainWindow::select_System(){
|
|
|
|
|
this->tempate_icon_select(this->iconSystem,list_System);
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> >k_list){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto selected = (*icon).get_selected_items();
|
|
|
|
|
if(!selected.empty())
|
|
|
|
|
{
|
|
|
|
|
@ -301,12 +291,8 @@ void MainWindow::unselect_icon(Gtk::IconView *icon_entry){
|
|
|
|
|
for (int index=0; index<10; ++index){
|
|
|
|
|
Gtk::IconView *icon = this->array_icon[index];
|
|
|
|
|
if (icon_entry!=icon){
|
|
|
|
|
cout << "11111" << endl;
|
|
|
|
|
icon->unselect_all();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
cout << "22222" << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -332,8 +318,6 @@ void MainWindow::settings(){
|
|
|
|
|
rbPkexec->set_sensitive(false);
|
|
|
|
|
rbSu->set_sensitive(false);
|
|
|
|
|
rbSudo->set_sensitive(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
void MainWindow::close_entry_app(){
|
|
|
|
|
this->icon_clear();
|
|
|
|
|
@ -358,9 +342,11 @@ void MainWindow::activ_or_block_execute_epriority(){
|
|
|
|
|
void MainWindow::open_filemaneg(){
|
|
|
|
|
wndChooseFileWallpaper->show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::close_filemaneg(){
|
|
|
|
|
wndChooseFileWallpaper->hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::get_path_filemaneg(){
|
|
|
|
|
path_file = wndChooseFileWallpaper->get_filename();
|
|
|
|
|
if (path_file.length()==0){}
|
|
|
|
|
@ -386,7 +372,6 @@ void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::Ref
|
|
|
|
|
|
|
|
|
|
void MainWindow::open_list_app(){
|
|
|
|
|
this->template_apps_obj(iconGraphics, list_Graphics);
|
|
|
|
|
|
|
|
|
|
this->template_apps_obj(iconTools, list_Tools);
|
|
|
|
|
this->template_apps_obj(iconInternet, list_Internet);
|
|
|
|
|
this->template_apps_obj(iconMultimedia, list_Multimedia);
|
|
|
|
|
@ -434,12 +419,10 @@ void MainWindow::open_list_app(){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dialogStartMenu->show_all();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::start_cmd(){
|
|
|
|
|
//txtCmd->set_text("");
|
|
|
|
|
string str_cmd_terminal="";
|
|
|
|
|
string str_variants_root = "";
|
|
|
|
|
string str_nice_cmd = "";
|
|
|
|
|
@ -477,7 +460,7 @@ void MainWindow::start_cmd(){
|
|
|
|
|
str_variants_root="su --user " + cmbUser->get_active_text() + " ";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
str_variants_root="su" ;
|
|
|
|
|
str_variants_root="su";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (rbSudo->get_active()){
|
|
|
|
|
@ -530,7 +513,6 @@ void MainWindow::start_cmd(){
|
|
|
|
|
txtCmd->set_text(cmd);
|
|
|
|
|
cmd = cmd + " &";
|
|
|
|
|
system(cmd.c_str());
|
|
|
|
|
|
|
|
|
|
path_file_name = "";
|
|
|
|
|
path_file = "";
|
|
|
|
|
name_app = "";
|
|
|
|
|
@ -556,15 +538,12 @@ void MainWindow::changed_user(){
|
|
|
|
|
lblTime4EpriorityHigh->set_text("0 (Высокий)");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//void MainWindow::execute_terminal(){}
|
|
|
|
|
//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);
|
|
|
|
|
|
|
|
|
|
lblInfoUserName->set_sensitive(flag);
|
|
|
|
|
if (flag_pkexec==true){
|
|
|
|
|
rbPkexec->set_sensitive(flag);
|
|
|
|
|
}
|
|
|
|
|
@ -575,12 +554,15 @@ void MainWindow::activ_or_block_other_user(){
|
|
|
|
|
rbSudo->set_sensitive(flag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::change_scale_priority(){
|
|
|
|
|
scalePriority->set_value(spinPriority->get_value_as_int());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::change_spin_priority(){
|
|
|
|
|
spinPriority->set_value(scalePriority->get_value());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::pars_dir_bin(){
|
|
|
|
|
namespace fs = std::filesystem;
|
|
|
|
|
std::string path = "/bin";
|
|
|
|
|
@ -601,9 +583,10 @@ void MainWindow::pars_dir_bin(){
|
|
|
|
|
rbSu->set_sensitive(flag_su);
|
|
|
|
|
rbSudo->set_sensitive(flag_sudo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::pars_users(){
|
|
|
|
|
while (true) {
|
|
|
|
|
errno = 0; // so we can distinguish errors from no more entries
|
|
|
|
|
errno = 0;
|
|
|
|
|
passwd* entry = getpwent();
|
|
|
|
|
if (!entry) {
|
|
|
|
|
if (errno) {
|
|
|
|
|
@ -616,7 +599,6 @@ void MainWindow::pars_users(){
|
|
|
|
|
cmbUser->append(entry->pw_name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cmbUser->append("root");
|
|
|
|
|
endpwent();
|
|
|
|
|
}
|
|
|
|
|
@ -627,7 +609,6 @@ vector<std::string> MainWindow::split(const std::string &s, char delim) {
|
|
|
|
|
std::vector<std::string> elems;
|
|
|
|
|
while (std::getline(ss, item, delim)) {
|
|
|
|
|
elems.push_back(item);
|
|
|
|
|
// elems.push_back(std::move(item)); // if C++11 (based on comment from @mchiasson)
|
|
|
|
|
}
|
|
|
|
|
return elems;
|
|
|
|
|
}
|
|
|
|
|
@ -687,6 +668,7 @@ void MainWindow::pars_apps(){
|
|
|
|
|
list_app.push_back(App);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder)
|
|
|
|
|
: Gtk::Plug{p_socketID} {
|
|
|
|
|
MainWindow* wnd = nullptr;
|
|
|
|
|
|