@ -0,0 +1,6 @@
|
|||||||
|
ublexec.glade~
|
||||||
|
#ublexec.glade#
|
||||||
|
test.cpp
|
||||||
|
.vscode
|
||||||
|
ublexec
|
||||||
|
nohup.out
|
||||||
@ -0,0 +1,141 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
#SHELL := /bin/bash
|
||||||
|
MAKEFILE_FILEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||||
|
MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_FILEPATH))))
|
||||||
|
MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH))
|
||||||
|
|
||||||
|
CMAKE_COMMAND = cmake
|
||||||
|
#CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source
|
||||||
|
#CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile
|
||||||
|
CMAKE_SOURCE_DIR = ./source
|
||||||
|
CMAKE_BUILD_DIR = ./compile
|
||||||
|
DEPENDS = cmake
|
||||||
|
#PKGNAME = $(MAKEFILE_DIR)
|
||||||
|
PKGNAME = ublexec
|
||||||
|
|
||||||
|
default_target: all
|
||||||
|
all: init build
|
||||||
|
|
||||||
|
init:
|
||||||
|
@echo "Initialize ..."; \
|
||||||
|
version="$$(cat VERSION.md)"; \
|
||||||
|
version=$${version:8}; \
|
||||||
|
search="s/string version_application.*$&"; \
|
||||||
|
replace="string version_application = \"$${version}\";"; \
|
||||||
|
sed -i -e "$$search/$$replace/gi" source/ublexec.h; \
|
||||||
|
echo "-- Build path: ${CMAKE_BUILD_DIR}"
|
||||||
|
|
||||||
|
depend:
|
||||||
|
@echo "Check depends ..."; \
|
||||||
|
if [ ! -f /bin/${DEPENDS} ]; then \
|
||||||
|
echo "-- Depend '${DEPENDS}' not fount !"; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
echo "Check depends: OK"
|
||||||
|
# $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||||
|
|
||||||
|
debug:
|
||||||
|
@echo "Debug ..."
|
||||||
|
if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
|
||||||
|
$(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="/usr"; \
|
||||||
|
fi; \
|
||||||
|
echo "Debug: OK"
|
||||||
|
|
||||||
|
prepare:
|
||||||
|
@echo "Prepare ..."; \
|
||||||
|
if [ ! -d ${CMAKE_BUILD_DIR} ]; then \
|
||||||
|
$(CMAKE_COMMAND) -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr"; \
|
||||||
|
fi; \
|
||||||
|
echo "Prepare: OK"
|
||||||
|
|
||||||
|
check:
|
||||||
|
@echo "Check ..."; \
|
||||||
|
if [ -f ${CMAKE_BUILD_DIR}/${PKGNAME} ]; then \
|
||||||
|
echo "Check: OK"; \
|
||||||
|
else \
|
||||||
|
echo "Check: ${CMAKE_BUILD_DIR}/${PKGNAME} not fount !"; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
build: depend prepare
|
||||||
|
@echo "Build ..."; \
|
||||||
|
make --directory=${CMAKE_BUILD_DIR}; \
|
||||||
|
echo "Build: OK"
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
@echo "Uninstall ..."
|
||||||
|
@for FILE_PO in $(wildcard *.po); do \
|
||||||
|
LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
|
||||||
|
FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
|
||||||
|
PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
|
||||||
|
$(RM) "/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
|
||||||
|
done
|
||||||
|
# @for SIZE in 16x16 32x32 48x48 scalable; do \
|
||||||
|
$(RM) "/usr/share/icons/hicolor/$${SIZE}/apps/${PKGNAME}.svg"; \
|
||||||
|
$(RM) "/usr/share/icons/hicolor/$${SIZE}/apps/${PKGNAME}.png"; \
|
||||||
|
done
|
||||||
|
# @for FILE_SVG in $(wildcard *.svg); do \
|
||||||
|
for SIZE in 16x16 32x32 48x48 scalable; do \
|
||||||
|
$(RM) "/usr/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \
|
||||||
|
done; \
|
||||||
|
done
|
||||||
|
@$(RM) "/usr/bin/${PKGNAME}"
|
||||||
|
@$(RM) "/usr/share/applications/${PKGNAME}.desktop"
|
||||||
|
@$(RM) "/usr/share/polkit-1/actions/ru.ublinux.pkexec.${PKGNAME}.exec.policy"
|
||||||
|
@$(RM) -rd "/usr/share/${PKGNAME}"
|
||||||
|
@gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null
|
||||||
|
@update-desktop-database --quiet 2>/dev/null
|
||||||
|
@touch /usr/share/applications
|
||||||
|
@echo "Uninstall: OK"
|
||||||
|
|
||||||
|
install: check uninstall
|
||||||
|
@echo "Install ..."
|
||||||
|
@for FILE_PO in $(wildcard *.po); do \
|
||||||
|
LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
|
||||||
|
install -dm755 /usr/share/locale/$${LANG}/LC_MESSAGES; \
|
||||||
|
FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \
|
||||||
|
PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \
|
||||||
|
echo $${FILE_PO}; \
|
||||||
|
msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \
|
||||||
|
done
|
||||||
|
@for SIZE in 16 32 48; do \
|
||||||
|
install -dm755 /usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps; \
|
||||||
|
rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data ${PKGNAME}.svg -o "/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/${PKGNAME}.svg"; \
|
||||||
|
done
|
||||||
|
@install -dm755 /usr/share/icons/hicolor/scalable/apps
|
||||||
|
@install -Dm644 -t /usr/share/icons/hicolor/scalable/apps/ ${PKGNAME}.svg
|
||||||
|
@install -Dm755 -t /usr/bin/ ${CMAKE_BUILD_DIR}/${PKGNAME}
|
||||||
|
@install -Dm644 -t /usr/share/applications/ ${PKGNAME}.desktop
|
||||||
|
@install -Dm644 -t /usr/share/polkit-1/actions/ org.ublinux.pkexec.${PKGNAME}.exec.policy
|
||||||
|
@install -dm755 /usr/share/${PKGNAME}/{ui,css,images}
|
||||||
|
@install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.glade
|
||||||
|
@install -Dm644 -t /usr/share/${PKGNAME}/css/ style.css
|
||||||
|
@install -Dm644 -t /usr/share/${PKGNAME}/images/ bg_top.png
|
||||||
|
@install -Dm644 -t /usr/share/${PKGNAME}/images/ ${PKGNAME}.svg
|
||||||
|
# @install -Dm644 -t /usr/share/${PKGNAME}/images/ ${PKGNAME}.png
|
||||||
|
@gtk-update-icon-cache -fiq /usr/share/icons/hicolor/
|
||||||
|
@update-desktop-database --quiet 2>/dev/null
|
||||||
|
@touch /usr/share/applications
|
||||||
|
@echo "Install: OK"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Clean ..."
|
||||||
|
@$(RM) -rd ${CMAKE_BUILD_DIR}
|
||||||
|
@if [ -d ${CMAKE_BUILD_DIR} ]; then \
|
||||||
|
echo "Clean: error, compile directory exist ${CMAKE_BUILD_DIR}"; \
|
||||||
|
else \
|
||||||
|
echo "Clean: OK"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "The following are some of the valid targets for this Makefile:"
|
||||||
|
@echo "... all (the default if no target is provided)"
|
||||||
|
@echo "... init"
|
||||||
|
@echo "... debug"
|
||||||
|
@echo "... prepare"
|
||||||
|
@echo "... compile"
|
||||||
|
@echo "... install"
|
||||||
|
@echo "... uninstall"
|
||||||
|
@echo "... clean"
|
||||||
@ -1,2 +1,28 @@
|
|||||||
# ublexec
|
# ublexec
|
||||||
|
# Выполнить
|
||||||
|
# Build
|
||||||
|
In order to build ublexec you will need:
|
||||||
|
|
||||||
|
- CMake
|
||||||
|
- C compiler
|
||||||
|
- GTK+ 3 & dependencies
|
||||||
|
|
||||||
|
Once you have all the necessary dependencies, you can use:
|
||||||
|
```sh
|
||||||
|
$ make
|
||||||
|
```
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
After a successful build, just use:
|
||||||
|
```sh
|
||||||
|
$ sudo make install clean
|
||||||
|
```
|
||||||
|
|
||||||
|
# Uninstallation
|
||||||
|
After a successful build, just use:
|
||||||
|
```sh
|
||||||
|
$ sudo make uninstall
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
VERSION 1.0
|
||||||
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 61 KiB |
@ -0,0 +1,30 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
project(ublexec)
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
pkg_check_modules(GTK REQUIRED gtkmm-3.0)
|
||||||
|
include_directories(${GTK_INCLUDE_DIRS})
|
||||||
|
link_directories(${GTK_LIBRARY_DIRS})
|
||||||
|
add_definitions(${GTK_CFLAGS_OTHER})
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a -g")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wmissing-declarations -fdiagnostics-color=always")
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
set(SOURCE_FILES
|
||||||
|
main.cc
|
||||||
|
ublexec.cc
|
||||||
|
ublexec.h
|
||||||
|
ubl-util-standard.h
|
||||||
|
ubl-util-standard.c)
|
||||||
|
|
||||||
|
set(LIBRARIES
|
||||||
|
${GTK_LIBRARIES}
|
||||||
|
pthread)
|
||||||
|
|
||||||
|
add_executable(ublexec ${SOURCE_FILES})
|
||||||
|
target_link_libraries(ublexec ${LIBRARIES} Threads::Threads)
|
||||||
|
install(TARGETS ublexec DESTINATION bin)
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
#include "ublexec.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
string str_cmd_argv = "";
|
||||||
|
for (int i=1; i<argc; i++){
|
||||||
|
str_cmd_argv+= to_string(*argv[i]) + " ";
|
||||||
|
}
|
||||||
|
if (geteuid()!=0){
|
||||||
|
//string cmd = "pkexec " + app_name + " " + str_cmd_argv;
|
||||||
|
//system(cmd.c_str());
|
||||||
|
//return 0;
|
||||||
|
}
|
||||||
|
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.plug");
|
||||||
|
auto builder = Gtk::Builder::create_from_file(path_glade);
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
bindtextdomain("ublexec", "/usr/share/locale/");
|
||||||
|
bind_textdomain_codeset("ublexec", "UTF-8");
|
||||||
|
textdomain("ublexec");
|
||||||
|
if (argc!=1){
|
||||||
|
Glib::init();
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
Glib::OptionContext context;
|
||||||
|
|
||||||
|
CmdArgParser parser{
|
||||||
|
"Socket ID",
|
||||||
|
"Command line argument for socket ID communication.",
|
||||||
|
"No help available, sorry"
|
||||||
|
};
|
||||||
|
|
||||||
|
context.set_main_group(parser);
|
||||||
|
context.parse(argc, argv);
|
||||||
|
|
||||||
|
::Window socketID = parser.GetSocketID();
|
||||||
|
|
||||||
|
// Handle plug:
|
||||||
|
SettingsPlug plug{socketID, builder};
|
||||||
|
plug.show();
|
||||||
|
|
||||||
|
app->run(plug);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
MainWindow* wnd = nullptr;
|
||||||
|
builder->get_widget_derived("window", wnd);
|
||||||
|
auto r = app->run(*wnd);
|
||||||
|
delete wnd;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
#include "ubl-util-standard.h"
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#ifndef UBL_GET_STANDARD_UI
|
||||||
|
#define UBL_GET_STANDARD_UI
|
||||||
|
|
||||||
|
|
||||||
|
inline returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id){
|
||||||
|
returnstruct *ret=(returnstruct*)malloc(sizeof(returnstruct*));
|
||||||
|
if (left_plug_id>0&&LeftWidget){
|
||||||
|
GtkWidget *plug=gtk_plug_new(left_plug_id);
|
||||||
|
GtkWidget *toplug=LeftWidget;
|
||||||
|
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||||
|
g_object_ref(G_OBJECT(toplug));
|
||||||
|
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||||
|
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
} else
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
gtk_widget_show(GTK_WIDGET(plug));
|
||||||
|
ret->plugLeft=plug;
|
||||||
|
}
|
||||||
|
if (right_plug_id>0&&RightWidget){
|
||||||
|
GtkWidget *plug=gtk_plug_new(right_plug_id);
|
||||||
|
GtkWidget *toplug=RightWidget;
|
||||||
|
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||||
|
g_object_ref(G_OBJECT(toplug));
|
||||||
|
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||||
|
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
} else
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
gtk_widget_show(GTK_WIDGET(plug));
|
||||||
|
ret->plugRight=plug;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
inline void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id){
|
||||||
|
if (left_plug_id>0&&LeftWidget){
|
||||||
|
GtkWidget *plug=gtk_plug_new(left_plug_id);
|
||||||
|
GtkWidget *toplug=GTK_WIDGET(LeftWidget->gobj());
|
||||||
|
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||||
|
g_object_ref(G_OBJECT(toplug));
|
||||||
|
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||||
|
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
} else
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
gtk_widget_show(GTK_WIDGET(plug));
|
||||||
|
}
|
||||||
|
if (right_plug_id>0&&RightWidget){
|
||||||
|
GtkWidget *plug=gtk_plug_new(right_plug_id);
|
||||||
|
GtkWidget *toplug=GTK_WIDGET(RightWidget->gobj());
|
||||||
|
if (gtk_widget_get_parent(GTK_WIDGET(toplug))){
|
||||||
|
g_object_ref(G_OBJECT(toplug));
|
||||||
|
GtkWidget *parent=gtk_widget_get_parent(toplug);
|
||||||
|
gtk_container_remove(GTK_CONTAINER(parent),toplug);
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
} else
|
||||||
|
gtk_container_add(GTK_CONTAINER(plug),GTK_WIDGET(toplug));
|
||||||
|
gtk_widget_show(GTK_WIDGET(plug));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef __cplusplus
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#include <gtk/gtkx.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GtkWidget *plugLeft;
|
||||||
|
GtkWidget *plugRight;
|
||||||
|
|
||||||
|
|
||||||
|
} returnstruct;
|
||||||
|
static returnstruct *ubl_make_plugs(GtkWidget *LeftWidget, GtkWidget *RightWidget, int left_plug_id, int right_plug_id);
|
||||||
|
#else
|
||||||
|
#include <gtkmm.h>
|
||||||
|
#include <gtkmm/stock.h>
|
||||||
|
#include <gtkmm/window.h>
|
||||||
|
#include <gtkmm/plug.h>
|
||||||
|
|
||||||
|
|
||||||
|
static void ubl_make_plugs(Gtk::Widget *LeftWidget, Gtk::Widget *RightWidget, int left_plug_id, int right_plug_id);
|
||||||
|
#endif
|
||||||
@ -0,0 +1,753 @@
|
|||||||
|
#include "ublexec.h"
|
||||||
|
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 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;
|
||||||
|
socketIDArg.set_long_name("socket-id");
|
||||||
|
socketIDArg.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
|
||||||
|
socketIDArg.set_description("Settings manager socket");
|
||||||
|
|
||||||
|
Glib::OptionEntry socketExtId;
|
||||||
|
socketExtId.set_long_name("socket-ext-id");
|
||||||
|
socketExtId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
|
||||||
|
socketExtId.set_description("Settings manager secondary socket");
|
||||||
|
|
||||||
|
Glib::OptionEntry socketTrdId;
|
||||||
|
socketTrdId.set_long_name("socket-trd-id");
|
||||||
|
socketTrdId.set_flags(Glib::OptionEntry::FLAG_IN_MAIN);
|
||||||
|
socketTrdId.set_description("Settings manager secondary socket");
|
||||||
|
|
||||||
|
add_entry(socketIDArg, m_socketID);
|
||||||
|
add_entry(socketExtId, socket_ext_id_I);
|
||||||
|
add_entry(socketTrdId, socket_trd_id_I);
|
||||||
|
}
|
||||||
|
::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);
|
||||||
|
builder->get_widget("btnStart", btnStart);
|
||||||
|
builder->get_widget("chbTerminal", chbTerminal);
|
||||||
|
builder->get_widget("chbAnotherUser", chbAnotherUser);
|
||||||
|
builder->get_widget("cbxExecuteEpriority", cbxExecuteEpriority);
|
||||||
|
builder->get_widget("cmbUser", cmbUser);
|
||||||
|
builder->get_widget("spinPriority", spinPriority);
|
||||||
|
builder->get_widget("scalePriority", scalePriority);
|
||||||
|
builder->get_widget("rbPkexec", rbPkexec);
|
||||||
|
builder->get_widget("rbSu", rbSu);
|
||||||
|
builder->get_widget("rbSudo", rbSudo);
|
||||||
|
builder->get_widget("txtCmd", txtCmd);
|
||||||
|
builder->get_widget("wndChooseFileWallpaper", wndChooseFileWallpaper);
|
||||||
|
builder->get_widget("btnFilemangerExit", btnFilemangerExit);
|
||||||
|
builder->get_widget("btnFilemangerOk", btnFilemangerOk);
|
||||||
|
builder->get_widget("lblTimeEpriorityLow", lblTimeEpriorityLow);
|
||||||
|
builder->get_widget("lblTime4EpriorityHigh", lblTime4EpriorityHigh);
|
||||||
|
builder->get_widget("messageError", messageError);
|
||||||
|
builder->get_widget("lblMessageError", lblMessageError);
|
||||||
|
builder->get_widget("btnMessageErrorOk", btnMessageErrorOk);
|
||||||
|
builder->get_widget("btnMessageErrorOk", btnMessageErrorOk);
|
||||||
|
builder->get_widget("btnMessageErrorOk", btnMessageErrorOk);
|
||||||
|
builder->get_widget("dialogStartMenu", dialogStartMenu);
|
||||||
|
builder->get_widget("btnStartMenuOK", btnStartMenuOK);
|
||||||
|
builder->get_widget("btnStartMenuExit", btnStartMenuExit);
|
||||||
|
builder->get_widget("lblInfoHead", lblInfoHead);
|
||||||
|
builder->get_widget("lblinfoCmd", lblinfoCmd);
|
||||||
|
builder->get_widget("lblInfoTime", lblInfoTime);
|
||||||
|
builder->get_widget("labInfoExecutTerm", labInfoExecutTerm);
|
||||||
|
builder->get_widget("lblInfoUser", lblInfoUser);
|
||||||
|
builder->get_widget("lblInfoUserOther", lblInfoUserOther);
|
||||||
|
builder->get_widget("lblInfoUserName", lblInfoUserName);
|
||||||
|
builder->get_widget("lblInfoNooPriority", lblInfoNooPriority);
|
||||||
|
builder->get_widget("lblInfoExec", lblInfoExec);
|
||||||
|
builder->get_widget("lblInfoPriority", lblInfoPriority);
|
||||||
|
builder->get_widget("boxColor", boxColor);
|
||||||
|
builder->get_widget("lblGraphics", lblGraphics);
|
||||||
|
builder->get_widget("lblTools", lblTools);
|
||||||
|
builder->get_widget("lblInternet", lblInternet);
|
||||||
|
builder->get_widget("lblMultimedia", lblMultimedia);
|
||||||
|
builder->get_widget("lblSettings", lblSettings);
|
||||||
|
builder->get_widget("lblEducation", lblEducation);
|
||||||
|
builder->get_widget("lblOffice", lblOffice);
|
||||||
|
builder->get_widget("lblOther", lblOther);
|
||||||
|
builder->get_widget("lblDevelopment", lblDevelopment);
|
||||||
|
builder->get_widget("iconGraphics", iconGraphics);
|
||||||
|
builder->get_widget("iconTools", iconTools);
|
||||||
|
builder->get_widget("iconInternet", iconInternet);
|
||||||
|
builder->get_widget("iconMultimedia", iconMultimedia);
|
||||||
|
builder->get_widget("iconSettings", iconSettings);
|
||||||
|
builder->get_widget("iconEducation", iconEducation);
|
||||||
|
builder->get_widget("iconOffice", iconOffice);
|
||||||
|
builder->get_widget("iconOther", iconOther);
|
||||||
|
builder->get_widget("iconDevelopment", iconDevelopment);
|
||||||
|
builder->get_widget("iconSystem", iconSystem);
|
||||||
|
builder->get_widget("lblSystem", lblSystem);
|
||||||
|
builder->get_widget("lblHeaderName", lblHeaderName);
|
||||||
|
builder->get_widget("btnSynopsis", btnSynopsis);
|
||||||
|
builder->get_widget("btnAbout", btnAbout);
|
||||||
|
builder->get_widget("aboutWindows", aboutWindows);
|
||||||
|
builder->get_widget("btnSettings", btnSettings);
|
||||||
|
builder->get_widget("btnBoxAboutDialog", btnBoxAboutDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::set_icon_array(){
|
||||||
|
array_icon[0]=this->iconGraphics;
|
||||||
|
array_icon[1]=this->iconTools;
|
||||||
|
array_icon[2]=this->iconInternet;
|
||||||
|
array_icon[3]=this->iconMultimedia;
|
||||||
|
array_icon[4]=this->iconSettings;
|
||||||
|
array_icon[5]=this->iconEducation;
|
||||||
|
array_icon[6]=this->iconOffice;
|
||||||
|
array_icon[7]=this->iconOther;
|
||||||
|
array_icon[8]=this->iconDevelopment;
|
||||||
|
array_icon[9]=this->iconSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> >k_list_app){
|
||||||
|
gtk_list_app = Gtk::ListStore::create(m_Columns);
|
||||||
|
gtk_list_app->set_sort_column(m_Columns.m_col_description, Gtk::SORT_ASCENDING);
|
||||||
|
icon->set_model(gtk_list_app);
|
||||||
|
icon->set_text_column(m_Columns.m_col_description);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::add_CSS(){
|
||||||
|
Glib::RefPtr<Gtk::CssProvider> cssProvider = Gtk::CssProvider::create();
|
||||||
|
cssProvider->load_from_path(path_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_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(){
|
||||||
|
aboutWindows->set_website(_("https://wiki.ublinux.com"));
|
||||||
|
btnSynopsis->set_label(_("Help"));
|
||||||
|
btnAbout->set_label(_("About the program"));
|
||||||
|
aboutWindows->set_comments(_("ublexec"));
|
||||||
|
aboutWindows->set_website_label(_("Project Home Page"));
|
||||||
|
aboutWindows->set_version(_(version_application.c_str()));
|
||||||
|
lblHeaderName->set_text(_("ublexec"));
|
||||||
|
this->set_title(_("ublexec"));
|
||||||
|
btnStart->set_label(_("Run"));
|
||||||
|
wndChooseFileWallpaper->set_title(_("Please select File"));
|
||||||
|
dialogStartMenu->set_title(_("Selecting Programs"));
|
||||||
|
lblInfoHead->set_text(_("Running applications as a user with a\nspecified priority"));
|
||||||
|
lblinfoCmd->set_text(_("Command Line"));
|
||||||
|
lblInfoTime->set_text(_("Team"));
|
||||||
|
labInfoExecutTerm->set_text(_("Run in the terminal emulator"));
|
||||||
|
lblInfoUser->set_text(_("User"));
|
||||||
|
lblInfoUserOther->set_text(_("Run as another user"));
|
||||||
|
lblInfoUserName->set_text(_("User Name"));
|
||||||
|
lblInfoNooPriority->set_text(_("Priority"));
|
||||||
|
lblInfoExec->set_text(_("Change startup priority"));
|
||||||
|
lblInfoPriority->set_text(_("Priority"));
|
||||||
|
lblMessageError->set_text(_("Select an executable file or program"));
|
||||||
|
lblGraphics->set_text(_("Graphics"));
|
||||||
|
lblTools->set_text(_("Tools"));
|
||||||
|
lblInternet->set_text(_("Internet"));
|
||||||
|
lblMultimedia->set_text(_("Multimedia"));
|
||||||
|
lblSettings->set_text(_("Settings"));
|
||||||
|
lblEducation->set_text(_("Education"));
|
||||||
|
lblOffice->set_text(_("Office"));
|
||||||
|
lblOther->set_text(_("Other"));
|
||||||
|
lblDevelopment->set_text(_("Development"));
|
||||||
|
lblSystem->set_text(_("System"));
|
||||||
|
}
|
||||||
|
|
||||||
|
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(sigc::mem_fun(*this, &MainWindow::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));
|
||||||
|
btnFilemangerExit->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::close_filemaneg));
|
||||||
|
btnFilemangerOk->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::get_path_filemaneg));
|
||||||
|
cbxExecuteEpriority->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::activ_or_block_execute_epriority));
|
||||||
|
btnMessageErrorOk->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::message_gui_close));
|
||||||
|
btnStartMenuOK->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::start_menu_entry_app));
|
||||||
|
btnStartMenuExit->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::close_entry_app));
|
||||||
|
btnStartMenuOK->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::ok_close_entry_app));
|
||||||
|
iconGraphics->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Graphics));
|
||||||
|
iconTools->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Tools));
|
||||||
|
iconInternet->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Internet));
|
||||||
|
iconMultimedia->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Multimedia));
|
||||||
|
iconSettings->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Settings));
|
||||||
|
iconEducation->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Education));
|
||||||
|
iconOffice->signal_selection_changed().connect(sigc::mem_fun(*this,&MainWindow::select_Office));
|
||||||
|
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));
|
||||||
|
btnSynopsis->signal_activate().connect(sigc::mem_fun(*this, &MainWindow::synopsis_show));
|
||||||
|
btnAbout->signal_activate().connect([&](){aboutWindows->show();});
|
||||||
|
cmbUser->signal_changed().connect([&](){denamic_cmd();changed_user();});
|
||||||
|
rbSudo->signal_toggled().connect(sigc::mem_fun(*this, &MainWindow::denamic_cmd));
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
void MainWindow::delete_cmd(const int &x,const int &y){
|
||||||
|
if (y>1){
|
||||||
|
chbTerminal->set_active(false);
|
||||||
|
chbAnotherUser->set_active(false);
|
||||||
|
cbxExecuteEpriority->set_active(false);
|
||||||
|
txtCmd->set_text("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::focus_in_txt_cmd(GdkEventFocus* event){
|
||||||
|
if (user_cmd.length() != 0){
|
||||||
|
//user_cmd_old = user_cmd;gi
|
||||||
|
}
|
||||||
|
else if (name_app.length() != 0){
|
||||||
|
//name_app_old = name_app;
|
||||||
|
}
|
||||||
|
else if (path_file.length() != 0){
|
||||||
|
//path_file_old = path_file;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
user_cmd = txtCmd->get_text();
|
||||||
|
}
|
||||||
|
cmd_old = txtCmd->get_text();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::synopsis_show(){
|
||||||
|
system("xdg-open https://wiki.ublinux.ru/ru/home &");
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::icon_clear(){
|
||||||
|
list_Graphics->clear();
|
||||||
|
list_Tools->clear();
|
||||||
|
list_Internet->clear();
|
||||||
|
list_Multimedia->clear();
|
||||||
|
list_Settings->clear();
|
||||||
|
list_Education->clear();
|
||||||
|
list_Office->clear();
|
||||||
|
list_Other->clear();
|
||||||
|
list_Development->clear();
|
||||||
|
list_System->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ok_close_entry_app(){
|
||||||
|
this->icon_clear();
|
||||||
|
dialogStartMenu->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::select_Graphics(){
|
||||||
|
this->tempate_icon_select(this->iconGraphics,list_Graphics);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Tools(){
|
||||||
|
this->tempate_icon_select(this->iconTools,list_Tools);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Internet(){
|
||||||
|
this->tempate_icon_select(this->iconInternet,list_Internet);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Multimedia(){
|
||||||
|
this->tempate_icon_select(this->iconMultimedia,list_Multimedia);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Settings(){
|
||||||
|
this->tempate_icon_select(this->iconSettings,list_Settings);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Education(){
|
||||||
|
this->tempate_icon_select(this->iconEducation,list_Education);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Office(){
|
||||||
|
this->tempate_icon_select(this->iconOffice,list_Office);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Other(){
|
||||||
|
this->tempate_icon_select(this->iconOther,list_Other);
|
||||||
|
}
|
||||||
|
void MainWindow::select_Development(){
|
||||||
|
this->tempate_icon_select(this->iconDevelopment,list_Development);
|
||||||
|
}
|
||||||
|
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())
|
||||||
|
{
|
||||||
|
this->set_icon_array();
|
||||||
|
this->unselect_icon(icon);
|
||||||
|
const Gtk::TreeModel::Path& path = *selected.begin();
|
||||||
|
Gtk::TreeModel::iterator iter = gtk_list->get_iter(path);
|
||||||
|
Gtk::TreeModel::Row row = *iter;
|
||||||
|
auto app_name_exec = row[m_Columns.app_name_exec];
|
||||||
|
const Glib::ustring description = row[m_Columns.m_col_description];
|
||||||
|
path_file = "";
|
||||||
|
name_app = "";
|
||||||
|
user_cmd = "";
|
||||||
|
txtCmd->set_text(app_name_exec);
|
||||||
|
name_app = txtCmd->get_text();
|
||||||
|
int len_name_app = name_app.length();
|
||||||
|
string array_del[] = {"%f","%F","%d","%D","%n","%N","%U"};
|
||||||
|
for (auto &del_sim: array_del){
|
||||||
|
str_remove(name_app, del_sim);
|
||||||
|
if (name_app.length()!=len_name_app){
|
||||||
|
txtCmd->set_text(name_app);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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){
|
||||||
|
icon->unselect_all();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::settings(){
|
||||||
|
this->pars_apps();
|
||||||
|
this->get_builder();
|
||||||
|
this->event();
|
||||||
|
this->localization();
|
||||||
|
this->add_CSS();
|
||||||
|
spinPriority->set_range(0,19);
|
||||||
|
spinPriority->set_increments(1.0,-1.0);
|
||||||
|
scalePriority->set_range(0,19);
|
||||||
|
scalePriority->set_value(0);
|
||||||
|
lblTimeEpriorityLow->set_text("19 (Низкий)");
|
||||||
|
lblTime4EpriorityHigh->set_text("0 (Высокий)");
|
||||||
|
scalePriority->set_inverted(true);
|
||||||
|
this->pars_dir_bin();
|
||||||
|
this->pars_users();
|
||||||
|
this->activ_or_block_execute_epriority();
|
||||||
|
this->changed_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);
|
||||||
|
btnBoxAboutDialog->set_visible(false);
|
||||||
|
Gtk::Widget *boxAbout;
|
||||||
|
builder->get_widget("boxAbout",boxAbout);
|
||||||
|
|
||||||
|
ubl_make_plugs(boxAbout,boxAbout, 0, socket_trd_id_I);
|
||||||
|
|
||||||
|
}
|
||||||
|
void MainWindow::close_entry_app(){
|
||||||
|
this->icon_clear();
|
||||||
|
dialogStartMenu->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::start_menu_entry_app(){}
|
||||||
|
|
||||||
|
void MainWindow::message_gui_close(){
|
||||||
|
messageError->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::activ_or_block_execute_epriority(){
|
||||||
|
bool flag = cbxExecuteEpriority->get_active();
|
||||||
|
scalePriority->set_sensitive(flag);
|
||||||
|
spinPriority->set_sensitive(flag);
|
||||||
|
lblInfoNooPriority->set_sensitive(flag);
|
||||||
|
lblTimeEpriorityLow->set_sensitive(flag);
|
||||||
|
lblTime4EpriorityHigh->set_sensitive(flag);
|
||||||
|
this->denamic_cmd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::open_filemaneg(){
|
||||||
|
wndChooseFileWallpaper->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::close_filemaneg(){
|
||||||
|
wndChooseFileWallpaper->hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::get_path_filemaneg(){
|
||||||
|
name_app = "";
|
||||||
|
user_cmd = "";
|
||||||
|
path_file = wndChooseFileWallpaper->get_filename();
|
||||||
|
if (path_file.length() == 0){}
|
||||||
|
else{
|
||||||
|
txtCmd->set_text(path_file);
|
||||||
|
this->close_filemaneg();
|
||||||
|
|
||||||
|
}
|
||||||
|
this->denamic_cmd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list){
|
||||||
|
Gtk::TreeModel::Row row = *(dtk_list->append());
|
||||||
|
row[m_Columns.m_col_filename] = path;
|
||||||
|
row[m_Columns.m_col_description] = Name;
|
||||||
|
row[m_Columns.icon_name] = path;
|
||||||
|
row[m_Columns.app_name_exec] = Exec;
|
||||||
|
row[m_Columns.float_h_align] = 0.5;
|
||||||
|
row[m_Columns.float_w_align] = 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
this->template_apps_obj(iconSettings, list_Settings);
|
||||||
|
this->template_apps_obj(iconEducation, list_Education);
|
||||||
|
this->template_apps_obj(iconOffice, list_Office);
|
||||||
|
this->template_apps_obj(iconOther, list_Other);
|
||||||
|
this->template_apps_obj(iconDevelopment, list_Development);
|
||||||
|
this->template_apps_obj(iconSystem, list_System);
|
||||||
|
string path = "";
|
||||||
|
for ( const auto &st_app : list_app){
|
||||||
|
for ( const auto &str_categor : st_app.Categories){
|
||||||
|
path = st_app.Icon;
|
||||||
|
if (str_categor=="Graphics"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Graphics);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Utility"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Tools);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Network"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path,list_Internet);
|
||||||
|
}
|
||||||
|
else if (str_categor== "AudioVideo"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Multimedia);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Settings"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Settings);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Education"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Education);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Office"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Office);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Other"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Other);
|
||||||
|
}
|
||||||
|
else if (str_categor=="Development"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_Development);
|
||||||
|
}
|
||||||
|
else if (str_categor=="System"){
|
||||||
|
this->tempalte_row(st_app.Name,st_app.Exec, path, list_System);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dialogStartMenu->show_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string MainWindow::start_cmd(string user_cmd){
|
||||||
|
string str_cmd_terminal="";
|
||||||
|
string str_variants_root = "";
|
||||||
|
string str_nice_cmd = "";
|
||||||
|
if (chbAnotherUser->get_active()){
|
||||||
|
if (geteuid()!=0){
|
||||||
|
//chbTerminal->set_active(true);
|
||||||
|
}
|
||||||
|
if (rbPkexec->get_active()){
|
||||||
|
str_variants_root = " pkexec --user " + cmbUser->get_active_text();
|
||||||
|
if (cbxExecuteEpriority->get_active()){
|
||||||
|
str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int());
|
||||||
|
}
|
||||||
|
str_variants_root += " env PATH=$PATH DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY ";
|
||||||
|
}
|
||||||
|
else if (rbSu->get_active()){
|
||||||
|
chbTerminal->set_active(true);
|
||||||
|
string str_user = cmbUser->get_active_text();
|
||||||
|
if (str_user!="root"){
|
||||||
|
str_variants_root = "su -l " + cmbUser->get_active_text();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
str_variants_root = "su ";
|
||||||
|
}
|
||||||
|
|
||||||
|
str_variants_root += + " -c \" DISPLAY=$DISPLAY ";
|
||||||
|
if (cbxExecuteEpriority->get_active()){
|
||||||
|
str_variants_root += "nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (rbSudo->get_active()){
|
||||||
|
chbTerminal->set_active(true);
|
||||||
|
if (getlogin()==cmbUser->get_active_text()){
|
||||||
|
str_variants_root="sudo ";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
str_variants_root="sudo -u " + cmbUser->get_active_text() + " ";
|
||||||
|
}
|
||||||
|
if (cbxExecuteEpriority->get_active()){
|
||||||
|
str_variants_root += " nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cmbUser->get_active_text().length()!=0){
|
||||||
|
string user_cmd_X = "xhost +SI:localuser:";
|
||||||
|
user_cmd_X += cmbUser->get_active_text();
|
||||||
|
system(user_cmd_X.c_str());
|
||||||
|
}
|
||||||
|
if ((cbxExecuteEpriority->get_active()) && (chbAnotherUser->get_active()==false)){
|
||||||
|
str_nice_cmd = " nice -n " + to_string(spinPriority->get_value_as_int()) + " ";
|
||||||
|
}
|
||||||
|
if (user_cmd.length()==0 && name_app.length()==0 && path_file.length()==0){
|
||||||
|
messageError->show();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chbTerminal->get_active() == true){
|
||||||
|
str_cmd_terminal = "xterm -e ";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
str_cmd_terminal = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
string cmd = "";
|
||||||
|
if (path_file.length()>0){
|
||||||
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " xdg-open '" + path_file + "' ";
|
||||||
|
}
|
||||||
|
else if (name_app.length()>0){
|
||||||
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + name_app;
|
||||||
|
}
|
||||||
|
else if (user_cmd.length()>0){
|
||||||
|
cmd = "nohup " + str_nice_cmd + str_cmd_terminal + str_variants_root + " " + user_cmd;
|
||||||
|
}
|
||||||
|
if (cmd.find("-e su ")!=string::npos){
|
||||||
|
cmd+=" \"";
|
||||||
|
}
|
||||||
|
cmd += " > /dev/null 2>&1";
|
||||||
|
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::call_app(string &cmd){
|
||||||
|
if (cmd.length() != 0){
|
||||||
|
std::thread t([&](string cmd){system(cmd.c_str());}, cmd);
|
||||||
|
t.detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void MainWindow::denamic_cmd(){
|
||||||
|
if (chbTerminal->get_active()==true || chbAnotherUser->get_active()==true || cbxExecuteEpriority->get_active()==true){
|
||||||
|
if (txtCmd->get_text().length()==0){
|
||||||
|
chbTerminal->set_active(false);
|
||||||
|
chbAnotherUser->set_active(false);
|
||||||
|
cbxExecuteEpriority->set_active(false);
|
||||||
|
path_file = "";
|
||||||
|
name_app = "";
|
||||||
|
user_cmd = "";
|
||||||
|
txtCmd->set_text(user_cmd);
|
||||||
|
messageError->show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
txtCmd->set_text(this->start_cmd(user_cmd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (user_cmd.length() != 0){
|
||||||
|
txtCmd->set_text(this->start_cmd(user_cmd));
|
||||||
|
}
|
||||||
|
else if (path_file.length() != 0){
|
||||||
|
txtCmd->set_text(this->start_cmd(user_cmd));
|
||||||
|
}
|
||||||
|
else if (name_app.length() != 0){
|
||||||
|
txtCmd->set_text(this->start_cmd(user_cmd));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MainWindow::focus_out_txt_cmd(GdkEventFocus* event){
|
||||||
|
if (cmd_old!=txtCmd->get_text()){
|
||||||
|
user_cmd = txtCmd->get_text();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::entry_app(){
|
||||||
|
this->denamic_cmd();
|
||||||
|
if (name_app.length()==0 && path_file.length()==0){
|
||||||
|
|
||||||
|
}
|
||||||
|
string cmd = txtCmd->get_text();
|
||||||
|
this->call_app(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::changed_user(){
|
||||||
|
Glib::ustring entry_user = cmbUser->get_active_text();
|
||||||
|
if (geteuid()==0 || entry_user == "root"){
|
||||||
|
spinPriority->set_range(-20,19);
|
||||||
|
spinPriority->set_increments(1.0,-1.0);
|
||||||
|
scalePriority->set_range(-20,19);
|
||||||
|
scalePriority->set_value(0);
|
||||||
|
lblTimeEpriorityLow->set_text("19 (Низкий)");
|
||||||
|
lblTime4EpriorityHigh->set_text("-20 (Высокий)");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
spinPriority->set_range(0,19);
|
||||||
|
spinPriority->set_increments(1.0,-1.0);
|
||||||
|
scalePriority->set_range(0,19);
|
||||||
|
scalePriority->set_value(0);
|
||||||
|
lblTimeEpriorityLow->set_text("19 (Низкий)");
|
||||||
|
lblTime4EpriorityHigh->set_text("0 (Высокий)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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){
|
||||||
|
rbPkexec->set_sensitive(flag);
|
||||||
|
}
|
||||||
|
if (flag_su == true){
|
||||||
|
rbSu->set_sensitive(flag);
|
||||||
|
}
|
||||||
|
if (flag_sudo == true){
|
||||||
|
rbSudo->set_sensitive(flag);
|
||||||
|
}
|
||||||
|
this->denamic_cmd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::change_scale_priority(){
|
||||||
|
scalePriority->set_value(spinPriority->get_value_as_int());
|
||||||
|
this->denamic_cmd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::change_spin_priority(){
|
||||||
|
spinPriority->set_value(scalePriority->get_value());
|
||||||
|
this->denamic_cmd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::pars_dir_bin(){
|
||||||
|
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=="su"){
|
||||||
|
flag_su = true;
|
||||||
|
}
|
||||||
|
else if (file_name=="sudo"){
|
||||||
|
flag_sudo = true;
|
||||||
|
}
|
||||||
|
else if (file_name=="pkexec"){
|
||||||
|
flag_pkexec = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rbPkexec->set_sensitive(flag_pkexec);
|
||||||
|
rbSu->set_sensitive(flag_su);
|
||||||
|
rbSudo->set_sensitive(flag_sudo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::pars_users(){
|
||||||
|
while (true) {
|
||||||
|
errno = 0;
|
||||||
|
passwd* entry = getpwent();
|
||||||
|
if (!entry) {
|
||||||
|
if (errno) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry->pw_uid >= 1000 && entry->pw_uid!=65534){
|
||||||
|
cmbUser->append(entry->pw_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmbUser->append("root");
|
||||||
|
endpwent();
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<std::string> MainWindow::split(const std::string &s, char delim) {
|
||||||
|
std::stringstream ss(s);
|
||||||
|
std::string item;
|
||||||
|
std::vector<std::string> elems;
|
||||||
|
while (std::getline(ss, item, delim)) {
|
||||||
|
elems.push_back(item);
|
||||||
|
}
|
||||||
|
return elems;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
i = source.find(to_remove))
|
||||||
|
source.erase(i, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::pars_apps(){
|
||||||
|
if (list_app.size()!=0){return;}
|
||||||
|
namespace fs = std::filesystem;
|
||||||
|
struct struct_App App;
|
||||||
|
string file_name = "";
|
||||||
|
string str_Categories;
|
||||||
|
string path = "/usr/share/applications/";
|
||||||
|
for (const auto & entry : fs::directory_iterator(path)){
|
||||||
|
file_name = entry.path().filename().string();
|
||||||
|
path = "/usr/share/applications/"+file_name;
|
||||||
|
if (file_name.find(".desktop")!=std::string::npos){
|
||||||
|
GKeyFile *gfile=g_key_file_new();
|
||||||
|
g_key_file_load_from_file(gfile,path.c_str(),G_KEY_FILE_KEEP_TRANSLATIONS,NULL);
|
||||||
|
char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL);
|
||||||
|
char *Name=g_key_file_get_locale_string(gfile,"Desktop Entry","Name",setlocale(LC_ALL,NULL),NULL);
|
||||||
|
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;
|
||||||
|
if (Categories==NULL) continue;
|
||||||
|
if (Icon==NULL) continue;
|
||||||
|
str_Categories = Categories;
|
||||||
|
App.Name = Name;
|
||||||
|
App.Type = Type;
|
||||||
|
App.Exec = Exec;
|
||||||
|
App.Icon = Icon;
|
||||||
|
if (Mime!=NULL){
|
||||||
|
App.MimeType = Mime;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
App.MimeType = "";
|
||||||
|
}
|
||||||
|
App.Name_desktop = file_name;
|
||||||
|
App.Categories = split(str_Categories, ';');
|
||||||
|
|
||||||
|
}
|
||||||
|
list_app.push_back(App);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsPlug::SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder)
|
||||||
|
: Gtk::Plug{p_socketID} {
|
||||||
|
MainWindow* wnd = nullptr;
|
||||||
|
builder->get_widget_derived("window", wnd);
|
||||||
|
builder->get_widget("plugBox", plugBox);
|
||||||
|
plugBox->get_parent()->remove(*plugBox);
|
||||||
|
add(*plugBox);
|
||||||
|
show_all_children();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,237 @@
|
|||||||
|
#include <gtkmm/window.h>
|
||||||
|
#include <glibmm/i18n.h>
|
||||||
|
#include <gtkmm/plug.h>
|
||||||
|
#include <gtkmm/stock.h>
|
||||||
|
#include <gtkmm.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <array>
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <ostream>
|
||||||
|
#include <thread>
|
||||||
|
#include <algorithm>
|
||||||
|
#include "ubl-util-standard.c"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
extern string path_app;
|
||||||
|
extern string app_name;
|
||||||
|
extern string path_glade;
|
||||||
|
extern string path_css;
|
||||||
|
extern int socket_ext_id_I;
|
||||||
|
extern int socket_trd_id_I;
|
||||||
|
void me_thread(string cmd);
|
||||||
|
class CmdArgParser : public Glib::OptionGroup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CmdArgParser(const std::string& p_name, const std::string& p_description, const std::string& p_help);
|
||||||
|
::Window GetSocketID() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_socketID = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class MainWindow : public Gtk::ApplicationWindow {
|
||||||
|
public:
|
||||||
|
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder);
|
||||||
|
MainWindow(Glib::RefPtr<Gtk::Builder> const& builder);
|
||||||
|
void template_apps_obj(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> >k_list_app);
|
||||||
|
void get_builder();
|
||||||
|
void add_CSS();
|
||||||
|
void localization();
|
||||||
|
void event();
|
||||||
|
void settings();
|
||||||
|
void close_entry_app();
|
||||||
|
void start_menu_entry_app();
|
||||||
|
void message_gui_close();
|
||||||
|
void activ_or_block_execute_epriority();
|
||||||
|
void open_filemaneg();
|
||||||
|
void close_filemaneg();
|
||||||
|
void get_path_filemaneg();
|
||||||
|
void open_list_app();
|
||||||
|
string start_cmd(string user_cmd);
|
||||||
|
void call_app(string &cmd);
|
||||||
|
void changed_user();
|
||||||
|
void entry_app();
|
||||||
|
void execute_another_User(){}
|
||||||
|
void activ_or_block_other_user();
|
||||||
|
void change_scale_priority();
|
||||||
|
void change_spin_priority();
|
||||||
|
void pars_dir_bin();
|
||||||
|
void pars_users();
|
||||||
|
void pars_apps();
|
||||||
|
void select_Graphics();
|
||||||
|
void tmp_desktop(string cmd_name);
|
||||||
|
void on_item_activated(const Gtk::TreeModel::Path& path);
|
||||||
|
void tempalte_row(string Name, string Exec, string path , Glib::RefPtr<Gtk::ListStore> &dtk_list);
|
||||||
|
void tempate_icon_select(Gtk::IconView *icon, Glib::RefPtr<Gtk::ListStore> >k_list);
|
||||||
|
void ok_close_entry_app();
|
||||||
|
void select_Tools();
|
||||||
|
void select_Internet();
|
||||||
|
void select_Multimedia();
|
||||||
|
void select_Settings();
|
||||||
|
void select_Education();
|
||||||
|
void select_Office();
|
||||||
|
void select_Other();
|
||||||
|
void select_Development();
|
||||||
|
void select_System();
|
||||||
|
void icon_clear();
|
||||||
|
void set_icon_array();
|
||||||
|
void delete_cmd(const int &x,const int &y);
|
||||||
|
void synopsis_show();
|
||||||
|
void denamic_cmd();
|
||||||
|
bool focus_out_txt_cmd(GdkEventFocus* event);
|
||||||
|
bool focus_in_txt_cmd(GdkEventFocus* event);
|
||||||
|
void unselect_icon(Gtk::IconView *icon_entry);
|
||||||
|
void str_remove(std::string& source, std::string & to_remove);
|
||||||
|
vector<std::string> split(const std::string &s, char delim);
|
||||||
|
public:
|
||||||
|
class ModelColumns : public Gtk::TreeModel::ColumnRecord
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ModelColumns()
|
||||||
|
{
|
||||||
|
add(m_col_filename);
|
||||||
|
add(m_col_description);
|
||||||
|
add(m_col_pixbuf);
|
||||||
|
add(app_name_exec);
|
||||||
|
add(float_h_align);
|
||||||
|
add(float_w_align);
|
||||||
|
add(icon_name);
|
||||||
|
|
||||||
|
}
|
||||||
|
Gtk::TreeModelColumn<std::string> m_col_filename;
|
||||||
|
Gtk::TreeModelColumn<std::string> icon_name;
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> m_col_description;
|
||||||
|
Gtk::TreeModelColumn<Glib::ustring> app_name_exec;
|
||||||
|
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > m_col_pixbuf;
|
||||||
|
Gtk::TreeModelColumn<float> float_h_align;
|
||||||
|
Gtk::TreeModelColumn<float> float_w_align;
|
||||||
|
};
|
||||||
|
ModelColumns m_Columns;
|
||||||
|
public:
|
||||||
|
Glib::RefPtr<Gtk::Builder> builder;
|
||||||
|
Gtk::Button *btnFilemaneg;
|
||||||
|
Gtk::Button *btnListApp;
|
||||||
|
Gtk::Button *btnStart;
|
||||||
|
Gtk::CheckButton *chbTerminal;
|
||||||
|
Gtk::CheckButton *chbAnotherUser;
|
||||||
|
Gtk::CheckButton *cbxExecuteEpriority;
|
||||||
|
Gtk::ComboBoxText *cmbUser;
|
||||||
|
Gtk::SpinButton *spinPriority;
|
||||||
|
Gtk::Scale *scalePriority;
|
||||||
|
Gtk::RadioButton *rbPkexec;
|
||||||
|
Gtk::RadioButton *rbSu;
|
||||||
|
Gtk::RadioButton *rbSudo;
|
||||||
|
Gtk::Entry *txtCmd;
|
||||||
|
Gtk::FileChooserDialog *wndChooseFileWallpaper;
|
||||||
|
Gtk::Button *btnFilemangerExit;
|
||||||
|
Gtk::Button *btnFilemangerOk;
|
||||||
|
Gtk::Label *lblTimeEpriority;
|
||||||
|
Gtk::Label *lblTimeEpriorityLow;
|
||||||
|
Gtk::Label *lblTime4EpriorityHigh;
|
||||||
|
Gtk::Label *lblUserName;
|
||||||
|
Gtk::MessageDialog *messageError;
|
||||||
|
Gtk::Button *btnMessageErrorOk;
|
||||||
|
Gtk::Label *lblMessageError;
|
||||||
|
Gtk::Button *btnStartMenuOK;
|
||||||
|
Gtk::Button *btnStartMenuExit;
|
||||||
|
Gtk::Window *dialogStartMenu;
|
||||||
|
Gtk::Box *boxColor;
|
||||||
|
Gtk::Label *lblInfoHead;
|
||||||
|
Gtk::Label *lblinfoCmd;
|
||||||
|
Gtk::Label *lblInfoTime;
|
||||||
|
Gtk::Label *labInfoExecutTerm;
|
||||||
|
Gtk::Label *lblInfoUser;
|
||||||
|
Gtk::Label *lblInfoUserOther;
|
||||||
|
Gtk::Label *lblInfoUserName;
|
||||||
|
Gtk::Label *lblInfoNooPriority;
|
||||||
|
Gtk::Label *lblInfoExec;
|
||||||
|
Gtk::Label *lblInfoPriority;
|
||||||
|
|
||||||
|
Gtk::Label *lblGraphics;
|
||||||
|
Gtk::Label *lblTools;
|
||||||
|
Gtk::Label *lblInternet;
|
||||||
|
Gtk::Label *lblMultimedia;
|
||||||
|
Gtk::Label *lblSettings;
|
||||||
|
Gtk::Label *lblEducation;
|
||||||
|
Gtk::Label *lblOffice;
|
||||||
|
Gtk::Label *lblOther;
|
||||||
|
Gtk::Label *lblDevelopment;
|
||||||
|
Gtk::Label *lblSystem;
|
||||||
|
Gtk::Label *lblHeaderName;
|
||||||
|
|
||||||
|
Gtk::IconView *iconGraphics;
|
||||||
|
Gtk::IconView *iconTools;
|
||||||
|
Gtk::IconView *iconInternet;
|
||||||
|
Gtk::IconView *iconMultimedia;
|
||||||
|
Gtk::IconView *iconSettings;
|
||||||
|
Gtk::IconView *iconEducation;
|
||||||
|
Gtk::IconView *iconOffice;
|
||||||
|
Gtk::IconView *iconOther;
|
||||||
|
Gtk::IconView *iconDevelopment;
|
||||||
|
Gtk::IconView *iconSystem;
|
||||||
|
Gtk::IconView *iconEntry;
|
||||||
|
Gtk::MenuItem *btnAbout;
|
||||||
|
Gtk::MenuItem *btnSynopsis;
|
||||||
|
Gtk::AboutDialog *aboutWindows;
|
||||||
|
Gtk::MenuButton *btnSettings;
|
||||||
|
Gtk::ButtonBox *btnBoxAboutDialog;
|
||||||
|
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Graphics;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Tools;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Internet;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Multimedia;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Settings;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Education;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Office;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Other;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_Development;
|
||||||
|
Glib::RefPtr<Gtk::ListStore> list_System;
|
||||||
|
public:
|
||||||
|
string version_application = "1.0";
|
||||||
|
string cmd_old = "";
|
||||||
|
string user_cmd="";
|
||||||
|
string user_cmd_old="";
|
||||||
|
string name_app_old="";
|
||||||
|
string path_file_old="";
|
||||||
|
string execute_cmd = "";
|
||||||
|
string path_file = "";
|
||||||
|
string name_app = "";
|
||||||
|
bool flag_pkexec = false;
|
||||||
|
bool flag_su = false;
|
||||||
|
bool flag_sudo = false;
|
||||||
|
string path_file_name;
|
||||||
|
struct struct_App{
|
||||||
|
string Name_desktop;
|
||||||
|
string Name;
|
||||||
|
string Exec;
|
||||||
|
string Icon;
|
||||||
|
string MimeType;
|
||||||
|
string Type;
|
||||||
|
vector<std::string> Categories;};
|
||||||
|
list <struct_App> list_app;
|
||||||
|
set <string> set_categories;
|
||||||
|
int index_exec_gui_apps = 0;
|
||||||
|
Gtk::IconView* array_icon[10];
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class SettingsPlug : public Gtk::Plug{
|
||||||
|
public:
|
||||||
|
Gtk::Window *window;
|
||||||
|
SettingsPlug(::Window p_socketID, Glib::RefPtr<Gtk::Builder> builder);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Gtk::Widget *plugBox;
|
||||||
|
Gtk::Widget *parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
.cssboxColor1{
|
||||||
|
background: url("/usr/share/ublexec/images/bg_top.png") no-repeat;
|
||||||
|
}
|
||||||
|
.textHead{
|
||||||
|
text-shadow: 1px 1px #ffffff;
|
||||||
|
}
|
||||||
|
.menuitemtop *{
|
||||||
|
margin:2px 2px 0 2px;
|
||||||
|
padding: 5px 10px 3px 5px;
|
||||||
|
}
|
||||||
|
.menuitemmiddle *{
|
||||||
|
margin:0 2px 0 2px;
|
||||||
|
padding: 3px 10px 3px 5px;
|
||||||
|
}
|
||||||
|
.menuitembottom *{
|
||||||
|
margin:0 2px 2px 2px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
.menuitemmiddle:hover* {
|
||||||
|
border-radius:3px;
|
||||||
|
margin:0 2px 0 2px;
|
||||||
|
padding: 3px 10px 3px 5px;
|
||||||
|
background:@theme_selected_bg_color;
|
||||||
|
border-color:transparent;
|
||||||
|
}
|
||||||
|
.menuitembottom:hover* {
|
||||||
|
border-radius:3px;
|
||||||
|
margin:0 2px 2px 2px;
|
||||||
|
padding: 3px 10px 5px 5px;
|
||||||
|
background:@theme_selected_bg_color;
|
||||||
|
border-color:transparent;
|
||||||
|
}
|
||||||
|
.menuitembottom{
|
||||||
|
margin-top:0px;
|
||||||
|
}
|
||||||
|
.menuitemmiddle{
|
||||||
|
margin-top:0px;
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menuitemtop{
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bkim{
|
||||||
|
background-image: -gtk-gradient(linear,
|
||||||
|
left top, left bottom,
|
||||||
|
from(@entry_background_a),
|
||||||
|
color-stop(0.20, @entry_background_b),
|
||||||
|
color-stop(0.85, @entry_background_c),
|
||||||
|
to(@entry_background_d));
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=ublexec
|
||||||
|
Name[ru]=Выполнить
|
||||||
|
GenericName=Execution from user rights
|
||||||
|
GenericName[ru]=Выполнить
|
||||||
|
Comment=Execution from user rights
|
||||||
|
Comment[ru]=Выполнить
|
||||||
|
Type=Application
|
||||||
|
Exec=ublexec
|
||||||
|
Icon=ublexec
|
||||||
|
Terminal=false
|
||||||
|
X-XfcePluggable=true
|
||||||
|
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;X-UBL-SettingsManager;X-UBL-SystemSettings;
|
||||||
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 212 KiB |
Loading…
Reference in new issue