Merge pull request 'develop' (#20) from develop into master

Reviewed-on: #20
pull/29/head
Dmitry Razumov 3 years ago
commit 71378afcc7

@ -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

@ -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<Gtk::StyleContext> context_box = boxColor->get_style_context();
Glib::RefPtr<Gtk::StyleContext> context_lbl_head = lblInfoHead->get_style_context();
Glib::RefPtr<Gtk::StyleContext> 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; index<len_termunal_cmd; index++) {
name_terminal_arr = termunal_cmd[index];
size_t index_term = name_terminal_arr.find(" ");
if (index_term != string::npos) {
name_terminal_arr =name_terminal_arr.substr(0, index_term);
if (name_terminal == name_terminal_arr) {
str_cmd_terminal = termunal_cmd[index];
}
}
}
}
else{
@ -684,6 +695,7 @@ void MainWindow::denamic_cmd() {
else if (name_app.length() != 0) {
txtCmd->set_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<std::string> 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;

@ -15,6 +15,7 @@
#include <ostream>
#include <thread>
#include <algorithm>
#include <fstream>
#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<std::string> split(const std::string &s, char delim);
public:
@ -198,7 +200,8 @@ public:
Glib::RefPtr<Gtk::ListStore> 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 = "";

@ -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;
}
.bkim{
opacity:0.99;
border:none;
}
.bkim_no_plug{
background-color: transparent;
opacity:0.99;
}

@ -18,7 +18,7 @@
<property name="urgency-hint">True</property>
<property name="accept-focus">False</property>
<property name="focus-on-map">False</property>
<property name="program-name">ubl-exec</property>
<property name="program-name">ublexec</property>
<property name="version">1.0</property>
<property name="copyright" translatable="yes">Copyright © UBSoft LLC, 2022 - </property>
<property name="comments" translatable="yes">ublexec</property>
@ -63,7 +63,7 @@
<property name="page-increment">10</property>
</object>
<object class="GtkWindow" id="dialogStartMenu">
<property name="width-request">450</property>
<property name="width-request">410</property>
<property name="height-request">240</property>
<property name="can-focus">False</property>
<property name="icon-name">ru.ublinux.ublexec</property>
@ -920,6 +920,12 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
</object>
<packing>
<property name="expand">True</property>
@ -933,6 +939,12 @@
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
</object>
<packing>
<property name="expand">True</property>
@ -1133,7 +1145,7 @@ specified priority</property>
</child>
<child>
<object class="GtkEntry" id="txtCmd">
<property name="width-request">381</property>
<property name="width-request">440</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="margin-left">5</property>
@ -1207,7 +1219,7 @@ specified priority</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="icon-name">edit-select-all</property>
<property name="icon-name">view-list-details</property>
</object>
</child>
</object>
@ -1279,7 +1291,7 @@ specified priority</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="margin-left">9</property>
<property name="margin-left">2</property>
<property name="margin-right">5</property>
<property name="margin-end">5</property>
<property name="margin-bottom">6</property>
@ -1398,6 +1410,7 @@ specified priority</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-left">6</property>
<property name="draw-indicator">True</property>
<property name="group">rbSu</property>
</object>
@ -1413,6 +1426,10 @@ specified priority</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-left">6</property>
<property name="margin-right">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="draw-indicator">True</property>
<property name="group">rbPkexec</property>
</object>
@ -1428,6 +1445,10 @@ specified priority</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="margin-left">6</property>
<property name="margin-right">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="draw-indicator">True</property>
<property name="group">rbSu</property>
</object>
@ -1489,7 +1510,7 @@ specified priority</property>
</child>
<child>
<object class="GtkComboBoxText" id="cmbUser">
<property name="width-request">381</property>
<property name="width-request">374</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>

@ -6,6 +6,12 @@
msgid ""
msgstr ""
msgid "File Overview"
msgstr ""
msgid "Application Overview"
msgstr ""
msgid "https://wiki.ublinux.com"
msgstr ""

@ -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"

Loading…
Cancel
Save