diff --git a/source/ubl-util-standard.c b/source/ubl-util-standard.c index 8cff122..3b753b1 100644 --- a/source/ubl-util-standard.c +++ b/source/ubl-util-standard.c @@ -44,6 +44,14 @@ inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, in if (left_plug_id>0&&LeftWidget){ GtkWidget *plug=gtk_plug_new(left_plug_id); GtkWidget *toplug=GTK_WIDGET(LeftWidget->gobj()); + {GdkScreen *screen = gtk_widget_get_screen(plug); + gtk_widget_set_app_paintable(plug,TRUE); + GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); + gtk_widget_set_visual(plug, colormap);} + {GdkScreen *screen = gtk_widget_get_screen(toplug); + gtk_widget_set_app_paintable(toplug,TRUE); + GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); + gtk_widget_set_visual(toplug, colormap);} if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ g_object_ref(G_OBJECT(toplug)); GtkWidget *parent=gtk_widget_get_parent(toplug); @@ -52,10 +60,21 @@ inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, in } else gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); gtk_widget_show(GTK_WIDGET(plug)); + gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim"); + gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim"); + gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar"); } if (right_plug_id>0&&RightWidget){ GtkWidget *plug=gtk_plug_new(right_plug_id); GtkWidget *toplug=GTK_WIDGET(RightWidget->gobj()); + {GdkScreen *screen = gtk_widget_get_screen(plug); + gtk_widget_set_app_paintable(plug,TRUE); + GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); + gtk_widget_set_visual(plug, colormap);} + {GdkScreen *screen = gtk_widget_get_screen(toplug); + gtk_widget_set_app_paintable(toplug,TRUE); + GdkVisual *colormap = gdk_screen_get_rgba_visual(screen); + gtk_widget_set_visual(toplug, colormap);} if (gtk_widget_get_parent(GTK_WIDGET(toplug))){ g_object_ref(G_OBJECT(toplug)); GtkWidget *parent=gtk_widget_get_parent(toplug); @@ -64,6 +83,9 @@ inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, in } else gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug)); gtk_widget_show(GTK_WIDGET(plug)); + gtk_style_context_add_class(gtk_widget_get_style_context(plug),"bkim"); + gtk_style_context_add_class(gtk_widget_get_style_context(toplug),"bkim"); + gtk_style_context_add_class(gtk_widget_get_style_context(plug),"primary-toolbar"); } } #endif \ No newline at end of file diff --git a/source/ublexec.cc b/source/ublexec.cc index 139f269..2639d41 100644 --- a/source/ublexec.cc +++ b/source/ublexec.cc @@ -1,11 +1,13 @@ #include "ublexec.h" using namespace std; + const string path_app = "/usr/bin/"; const string path_glade = "/usr/share/ublexec/ui/ublexec.glade"; const string path_css = "/usr/share/ublexec/css/style.css"; const string app_name = "ublexec"; int socket_ext_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) : Glib::OptionGroup{p_name, p_description, p_help} { Glib::OptionEntry socketIDArg; @@ -135,8 +137,12 @@ void MainWindow::add_CSS() { styleContext->add_provider_for_screen(screen, cssProvider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);//add provider for screen in all application Glib::RefPtr context_box = boxColor->get_style_context(); Glib::RefPtr context_lbl_head = lblInfoHead->get_style_context(); + Glib::RefPtr boxAbout_css = boxAbout->get_style_context(); context_box->add_class("cssboxColor1"); context_lbl_head->add_class("textHead"); + if (socket_ext_id_I == 0){ + boxAbout_css->add_class("bkim_no_plug"); + } } void MainWindow::localization() { @@ -177,14 +183,15 @@ void MainWindow::localization() { lblOther->set_text(_("Other")); lblDevelopment->set_text(_("Development")); lblSystem->set_text(_("System")); - + btnListApp->set_tooltip_text(_("Application Overview")); + btnFilemaneg->set_tooltip_text(_("File Overview")); } void MainWindow::event() { btnFilemaneg->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_filemaneg)); btnListApp->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::open_list_app)); btnStart->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::entry_app)); - chbTerminal->signal_toggled().connect([&]() {cmbTerminal->set_sensitive(chbTerminal->get_active());this->denamic_cmd();}); + chbTerminal->signal_toggled().connect([&]() {cmbTerminal->set_sensitive(chbTerminal->get_active());denamic_cmd();}); 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)); scalePriority->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::change_spin_priority)); @@ -207,13 +214,14 @@ void MainWindow::event() { iconSystem->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_System)); btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show)); btnAbout->signal_activate().connect([&]() {aboutWindows->show();}); - cmbUser->signal_changed().connect([&]() {changed_user();denamic_cmd();}); + cmbUser->signal_changed().connect([&]() {changed_user();this->denamic_cmd();}); rbSudo->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::sudo_nice)); txtCmd->signal_focus_out_event().connect(sigc::mem_fun(*this, &MainWindow::focus_out_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)); rbSu->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::sudo_nice)); rbPkexec->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::sudo_nice)); + cmbTerminal->signal_changed().connect([&]() {this->denamic_cmd();}); } @@ -289,8 +297,10 @@ bool MainWindow::focus_in_txt_cmd(GdkEventFocus* event) { if (user_cmd.length() != 0) { } else if (name_app.length() != 0) { + name_app = ""; } else if (path_file.length() != 0) { + path_file = ""; } else{ user_cmd = txtCmd->get_text(); @@ -605,19 +615,20 @@ string MainWindow::start_cmd(string user_cmd) { return ""; } if (chbTerminal->get_active() == true) { + string name_terminal_arr = ""; 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 = ""; + if (name_terminal.length() != 0) { + int len_termunal_cmd = sizeof(termunal_cmd)/sizeof(*termunal_cmd); + for (int index = 0; indexset_text(this->start_cmd(user_cmd)); } + } } @@ -722,7 +734,6 @@ void MainWindow::entry_app() { void MainWindow::activ_or_block_other_user() { bool flag = chbAnotherUser->get_active(); - cmbUser->set_active(0); cmbUser->set_sensitive(flag); lblInfoUserName->set_sensitive(flag); if (flag_pkexec == true) { @@ -772,19 +783,21 @@ void MainWindow::pars_dir_terminal() { namespace fs = std::filesystem; std::string path = "/bin"; string file_name = ""; + string name_terminal = ""; 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"); - } + int len_termunal_cmd = sizeof(termunal_cmd)/sizeof(*termunal_cmd); + for (int index = 0; index < len_termunal_cmd; ++index) { + name_terminal = termunal_cmd[index]; + size_t index_term = name_terminal.find(" "); + if (index_term != string::npos){ + name_terminal = name_terminal.substr(0, index_term); + if (name_terminal == file_name) { + cmbTerminal->append(name_terminal); + cmbTerminal->set_active_text(name_terminal); + } + } + } } } @@ -800,15 +813,50 @@ void MainWindow::is_user_wheel(){ } } +unsigned short MainWindow::read_uid_min_max(string filename, string search){ + std::string line; + int uid = 0; + string remove_tab = "\t"; + string remove_space = " "; + std::ifstream in(filename); // окрываем файл для чтения + if (in.is_open()){ + while (getline(in, line)){ + try{ + if (line.find(search) != string::npos && (line.find("SYS_"+search) == string::npos)) { + this->str_remove(line, search); + this->str_remove(line, remove_space); + this->str_remove(line, remove_tab); + uid = atoi(line.c_str()); + } + } + catch (int x) { + if (search == "UID_MIN"){ + uid = 1000; + } + else{ + uid = 65534; + } + + } + + } + } + else{ + if (search == "UID_MIN") { + uid = 1000; + } + else{ + uid = 65534; + } + } + in.close(); + return uid; + +} + void MainWindow::pars_users() { - //string str_uid_max = this->call("grep \"^UID_MAX\" /etc/login.defs | xargs | cut -d ' ' -f 2)"); - //int uid_max = 0; - //if (str_uid_max.length() > 3){ - // int uid_max = stoi(str_uid_max); - //} - //else{ - int uid_max = 65534; - //} + unsigned short uid_min = this->read_uid_min_max("/etc/login.defs", "UID_MIN"); + unsigned short uid_max = this->read_uid_min_max("/etc/login.defs", "UID_MAX"); while (true) { errno = 0; passwd* entry = getpwent(); @@ -818,7 +866,7 @@ void MainWindow::pars_users() { } break; } - if ((entry->pw_uid >= 1000 && entry->pw_uid < uid_max) || entry->pw_uid == 0) { + if ((entry->pw_uid >= uid_min && entry->pw_uid < uid_max) || entry->pw_uid == 0) { cmbUser->append(entry->pw_name); } } @@ -835,7 +883,7 @@ vector MainWindow::split(const std::string &s, char delim) { return elems; } -void MainWindow::str_remove(std::string& source, std::string & to_remove) { +void MainWindow::str_remove(std::string& source, std::string to_remove) { string::size_type n = to_remove.length(); for (string::size_type i = source.find(to_remove); i != string::npos; diff --git a/source/ublexec.h b/source/ublexec.h index 3a482c5..b14107b 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -15,6 +15,7 @@ #include #include #include +#include #include "ubl-util-standard.c" using namespace std; @@ -93,7 +94,8 @@ public: bool focus_in_txt_cmd(GdkEventFocus* event); void unselect_icon(Gtk::IconView *icon_entry); void pars_dir_terminal(); - void str_remove(std::string& source, std::string & to_remove); + unsigned short read_uid_min_max(string filename, string search); + void str_remove(std::string& source, std::string to_remove); string call(string cmd); vector split(const std::string &s, char delim); public: @@ -198,7 +200,8 @@ public: Glib::RefPtr list_System; Gtk::Widget *boxAbout; public: - string version_application = "1.0"; + string termunal_cmd[3] = {"konsole -e ", "xfce4-terminal -x ", "xterm -e "}; + string version_application = "1.2"; string cmd_old = ""; string user_exec_app = ""; string user_cmd = ""; diff --git a/style.css b/style.css index dea0dd6..fa795ee 100644 --- a/style.css +++ b/style.css @@ -4,6 +4,53 @@ .textHead{ text-shadow: 1px 1px #ffffff; } +.bannerbackground { + background-color: #404040; +} +#GnomeIcon{ + border-style:solid; + border-bottom-width: 1px; + border-image: linear-gradient(90deg, alpha(@theme_text_color,0.4) 55%, alpha(@theme_bg_color, 0) 100%); + border-image-slice: 1; +} + +#SepIcon{ + background-color: alpha(@theme_text_color, 0.6); +} + +#iconlabel { + font-size:14px; + font-weight: bold; + +} +.roundborder * { + border-width:0px; + border-radius:5px; +} +.noborder { + border: none; +} +.menu:hover { + border-color:alpha(@theme_text_color, 0.01); +} +.menu { + border-color:alpha(@theme_text_color, 0.01); +} +.menu:hover >* { + border-color:alpha(@theme_text_color, 0.01); +} +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; +} +.menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; +} + +.menuitemtop{ + margin-bottom:0px; +} .menuitemtop *{ margin:2px 2px 0 2px; padding: 5px 10px 3px 5px; @@ -17,47 +64,61 @@ padding: 3px 10px 5px 5px; } .menuitemtop:hover { - border-radius:3px; background:@theme_bg_color; } .menuitemmiddle:hover { - border-radius:3px; background:@theme_bg_color; } .menuitembottom:hover { - border-radius:3px; background:@theme_bg_color; } .menuitemtop:hover* { - border-radius:3px; margin:2px 2px 0 2px; padding: 5px 10px 3px 5px; background:@theme_selected_bg_color; - border-color:transparent; + border-radius:2px; } .menuitemmiddle:hover* { - border-radius:3px; margin:0 2px 0 2px; padding: 3px 10px 3px 5px; background:@theme_selected_bg_color; - border-color:transparent; + border-radius:2px; } .menuitembottom:hover* { - border-radius:3px; margin:0 2px 2px 2px; padding: 3px 10px 5px 5px; background:@theme_selected_bg_color; - border-color:transparent; + border-radius:2px; } -.menuitembottom{ - margin-top:0px; + +.workingbg, #workingbg { + background-color:@theme_base_color; } -.menuitemmiddle{ - margin-top:0px; - margin-bottom:0px; +.workingbg.view.cell:selected { + background-color:@theme_selected_bg_color; +} +.workingbg.view.cell:hover { + background-color:darker(@theme_selected_bg_color); + color:@theme_selected_text_color; + border-radius:3px; +} +.bkim { + transition: 200ms ease-out; + background-image: none; +} +.noborder{ +border:none; } -.menuitemtop{ - margin-bottom:0px; -} \ No newline at end of file +.bkim{ +opacity:0.99; +border:none; +} + +.bkim_no_plug{ +background-color: transparent; +opacity:0.99; +} + + diff --git a/ublexec.glade b/ublexec.glade index ca1e689..c7e888b 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -18,7 +18,7 @@ True False False - ubl-exec + ublexec 1.0 Copyright © UBSoft LLC, 2022 - ublexec @@ -63,7 +63,7 @@ 10 - 450 + 410 240 False ru.ublinux.ublexec @@ -920,6 +920,12 @@ True True True + 5 + 5 + 5 + 5 + 6 + 6 True @@ -933,6 +939,12 @@ True True True + 5 + 5 + 5 + 5 + 6 + 6 True @@ -1133,7 +1145,7 @@ specified priority - 381 + 440 True True 5 @@ -1207,7 +1219,7 @@ specified priority 5 5 5 - edit-select-all + view-list-details @@ -1279,7 +1291,7 @@ specified priority True False start - 9 + 2 5 5 6 @@ -1398,6 +1410,7 @@ specified priority True True False + 6 True rbSu @@ -1413,6 +1426,10 @@ specified priority True True False + 6 + 6 + 6 + 6 True rbPkexec @@ -1428,6 +1445,10 @@ specified priority True True False + 6 + 6 + 6 + 6 True rbSu @@ -1489,7 +1510,7 @@ specified priority - 381 + 374 True False 5 diff --git a/ublexec.pot b/ublexec.pot index dc8b95f..efdccec 100644 --- a/ublexec.pot +++ b/ublexec.pot @@ -6,6 +6,12 @@ msgid "" msgstr "" +msgid "File Overview" +msgstr "" + +msgid "Application Overview" +msgstr "" + msgid "https://wiki.ublinux.com" msgstr "" diff --git a/ublexec_ru.po b/ublexec_ru.po index 07acf1b..2b26faa 100644 --- a/ublexec_ru.po +++ b/ublexec_ru.po @@ -16,6 +16,12 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +msgid "File Overview" +msgstr "Обзор файлов" + +msgid "Application Overview" +msgstr "Обзор приложений" + msgid "https://wiki.ublinux.com" msgstr "https://wiki.ublinux.ru"