diff --git a/.gitignore b/.gitignore
index 1d74e21..ed27715 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,9 @@
.vscode/
+ubl-settings-TEMPLATE
+*~
+build/
+compile/
+*#
+terminal-commands/
+source/ubl-cmake.h
+vgcore*
\ No newline at end of file
diff --git a/Makefile b/Makefile
index dc489c7..07ba802 100644
--- a/Makefile
+++ b/Makefile
@@ -10,21 +10,25 @@ CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source
CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile
#CMAKE_SOURCE_DIR = ./source
#CMAKE_BUILD_DIR = ./compile
-FILE_VERSION = VERSION.md
DEPENDS = /bin/cmake
PREFIX ?= /usr
PKGNAME = $(MAKEFILE_DIR)
#PKGNAME = ubl-settings-manager
-
+LATEST_TAG=
default_target: all
-.PHONY: all init depend debug prepare check build uninstall install clean up_ver help
+.PHONY: all init depend debug prepare check build uninstall install clean help
all: init build
init:
@echo "Initialize ..."; \
- sed -r "s/(version_application = ).*/\1\"$$(grep 'VERSION' ${FILE_VERSION} | cut -d" " -f2)\";/" -i source/ubl-settings-usergroups.h; \
+ if [ -d ".git" ]; then \
+ LATEST_TAG=$$(git describe --tags | sed 's/^v//'|grep -oE "^[0-9]{1,}.[0-9]{1,}"); \
+ else \
+ LATEST_TAG="0.0"; \
+ fi; \
+ sed -r "s/^(string version_application).*/\1=\"$${LATEST_TAG}\";/" -i source/${PKGNAME}.h; \
echo "-- Build path: ${CMAKE_BUILD_DIR}"
depend:
@@ -38,11 +42,13 @@ depend:
echo "Check depends: OK"
# $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
-debug:
- @echo "Debug ..."
+debug: init build
+ @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="${PREFIX}"; \
fi; \
+ echo "${CMAKE_BUILD_DIR}/${PKGNAME}"; \
+ cp ${CMAKE_BUILD_DIR}/${PKGNAME} ./; \
echo "Debug: OK"
prepare:
@@ -86,7 +92,9 @@ uninstall:
@$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}"
@$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop"
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg"
- @$(RM) -rd "${DESTDIR}${PREFIX}/share/${PKGNAME}"
+ @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.checked.svg"
+ @$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.warning.svg"
+ @$(RM) "${DESTDIR}${PREFIX}/share/polkit-1/actions/com.ublinux.${PKGNAME}.policy"
@if [ -z ${DESTDIR} ]; then \
[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
@@ -96,6 +104,9 @@ uninstall:
install: check uninstall
@echo "Install ..."
+#################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################
+ @gcc source/ubl-cmake.h compile/resources.c compile/ubl-cmake.h source/ubl-settings-usergroups.c source/ubl-settings-usergroups.h source/ubl-strings.h source/ubl-utils.c source/ubl-utils.h -o ubl-settings-usergroups `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g
+#################################################### УДАЛИТЬ ПЕРЕД КОММИТОМ ################################################################################
@for FILE_PO in $(wildcard *.po); do \
LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \
install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \
@@ -110,19 +121,21 @@ install: check uninstall
done
@install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg"
+ @install -dm755 "${DESTDIR}${PREFIX}/share/polkit-1/actions"
+ @install -Dm644 -t "${DESTDIR}${PREFIX}/share/polkit-1/actions/" "com.ublinux.${PKGNAME}.policy"
@install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}"
@install -dm755 "${DESTDIR}/etc/xdg"
@install -dm755 "${DESTDIR}${PREFIX}/share/applications"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop"
- @install -dm755 "${DESTDIR}${PREFIX}/share/${PKGNAME}"/{ui,css,images}
- @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/ui/" "${PKGNAME}.glade"
- @install -Dm644 -t "${DESTDIR}${PREFIX}/share/${PKGNAME}/css/" "${PKGNAME}.css"
+ @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
+ @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg"
@if [ -z ${DESTDIR} ]; then \
[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
[ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
fi
@echo "Install: OK"
+ @sed -r "s/^(string version_application=\"*\").*/string version_application;/" -i source/${PKGNAME}.h; \
clean:
@echo "Clean ..."
diff --git a/README.md b/README.md
index 23810ff..006bbe3 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,12 @@
-# ubl-settings-usergroups
+# ubl-ubl-settings-usergroups
# Выполнить
# Build
-In order to build ubl-settings-manager you will need:
+In order to build ubl-ubl-settings-usergroups you will need:
- CMake
- C compiler
- GTK+ 3 & dependencies
+- webkit2gtk (optional)
Once you have all the necessary dependencies, you can use:
```sh
diff --git a/VERSION.md b/VERSION.md
deleted file mode 100644
index 31c5941..0000000
--- a/VERSION.md
+++ /dev/null
@@ -1 +0,0 @@
-VERSION 1.2
diff --git a/com.ublinux.ubl-settings-usergroups.checked.svg b/com.ublinux.ubl-settings-usergroups.checked.svg
new file mode 100644
index 0000000..e3cab42
--- /dev/null
+++ b/com.ublinux.ubl-settings-usergroups.checked.svg
@@ -0,0 +1,327 @@
+
+
diff --git a/com.ublinux.ubl-settings-usergroups.policy b/com.ublinux.ubl-settings-usergroups.policy
new file mode 100644
index 0000000..087a6b3
--- /dev/null
+++ b/com.ublinux.ubl-settings-usergroups.policy
@@ -0,0 +1,24 @@
+
+
+
+
+ UBLinux
+ https://ublinux.ru
+
+
+ Run ubl-ubl-settings-usergroups as root
+ Запуск утилиты ubl-ubl-settings-usergroups с правами root
+ Authentication is required to run ubl-ubl-settings-usergroups
+ Требуется авторизация для запуска утилиты ubl-ubl-settings-usergroups с правами root
+
+ auth_admin
+ auth_admin
+ auth_admin
+
+ /usr/bin/ubl-ubl-settings-usergroups
+ true
+
+
+
diff --git a/com.ublinux.ubl-settings-usergroups.warning.svg b/com.ublinux.ubl-settings-usergroups.warning.svg
new file mode 100644
index 0000000..9a90dba
--- /dev/null
+++ b/com.ublinux.ubl-settings-usergroups.warning.svg
@@ -0,0 +1,55 @@
+
+
diff --git a/gresource.xml b/gresource.xml
new file mode 100644
index 0000000..09b2fec
--- /dev/null
+++ b/gresource.xml
@@ -0,0 +1,14 @@
+
+
+
+ ubl-settings-usergroups.glade
+ ubl-settings-usergroups-group.glade
+ ubl-settings-usergroups-user.glade
+
+
+ ubl-settings-usergroups.css
+
+
+ ubl-settings-usergroups-banner.png
+
+
\ No newline at end of file
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 1bb765e..56e4492 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -8,22 +8,91 @@ include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS_OTHER})
+#pkg_check_modules(VTE291 REQUIRED vte-2.91)
+#include_directories(${VTE291_INCLUDE_DIRS})
+#link_directories(${VTE291_LIBRARY_DIRS})
+#add_definitions(${VTE291_CFLAGS_OTHER})
+
+find_library(WEBKIT_LIBRARIES_FOUND webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
+
+option(WEBKIT_FOUND "No" OFF)
+if(WEBKIT_LIBRARIES_FOUND)
+ option(WEBKIT_FOUND "Yes" ON)
+ PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0 webkit2gtk-web-extension-4.0)
+ include_directories(${WEBKIT_INCLUDE_DIRS})
+ link_directories(${WEBKIT_LIBRARY_DIRS})
+ add_definitions(${WEBKIT_CFLAGS_OTHER})
+endif()
+
+configure_file(ubl-cmake.in ubl-cmake.h)
+
+file(COPY ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h DESTINATION ./)
+
+set(GRESOURCE_C resources.c)
+set(GRESOURCE_XML gresource.xml)
+
+find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED)
+add_custom_target(GLADE ubl-settings-usergroups.glade)
+
+set(DEPENDFILES
+ ../ubl-settings-usergroups.glade
+ ../ubl-settings-usergroups-user.glade
+ ../ubl-settings-usergroups-group.glade
+ ../gresource.xml
+ ../ubl-settings-usergroups-banner.png
+ ../ubl-settings-usergroups.css
+ )
+
+file(COPY ${DEPENDFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
+add_custom_command(
+ OUTPUT ${GRESOURCE_C}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${GLIB_COMPILE_RESOURCES}
+ ARGS
+ --generate-source
+ --target=${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
+ ${GRESOURCE_XML}
+ VERBATIM
+ MAIN_DEPENDENCY ${GRESOURCE_XML}
+ DEPENDS
+ ${GLADE}
+)
+add_custom_target(
+ dummy-resource
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
+)
+
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
-O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection")
+
set(SOURCE_FILES
ubl-settings-usergroups.c
- ubl-settings-usergroups.h)
+ ubl-settings-usergroups.h
+ ubl-strings.h
+ ubl-utils.h
+ ubl-utils.c
+ ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h
+ )
set(LIBRARIES
${GTK_LIBRARIES}
+ ${WEBKIT_LIBRARIES}
+# ${VTE291_LIBRARIES}
pthread)
-add_executable(ubl-settings-usergroups ${SOURCE_FILES})
-target_link_libraries(ubl-settings-usergroups ${LIBRARIES})
-install(TARGETS ubl-settings-usergroups DESTINATION bin)
\ No newline at end of file
+add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})
+target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBRARIES})
+target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_BINARY_DIR})
+set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
+ PROPERTIES GENERATED TRUE
+)
+install(TARGETS ${PROJECT_NAME} DESTINATION bin)
+add_dependencies(${PROJECT_NAME} dummy-resource)
\ No newline at end of file
diff --git a/source/ubl-cmake.in b/source/ubl-cmake.in
new file mode 100644
index 0000000..d4623a7
--- /dev/null
+++ b/source/ubl-cmake.in
@@ -0,0 +1 @@
+#cmakedefine WEBKIT_FOUND
diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c
index 79a7ddc..ee77d87 100644
--- a/source/ubl-settings-usergroups.c
+++ b/source/ubl-settings-usergroups.c
@@ -1,11 +1,324 @@
-#include
#include "ubl-settings-usergroups.h"
+config main_config;
+
+//signal emmit handlers - no header initialization
+
+/**on_close_subwindow(GtkWidget *self)
+ * [EN]
+ * Closes window in which [self] is contained.
+ * [RU]
+ * Закрывает окно, в котором расположен виджет [self].
+*/
+void on_close_subwindow(GtkWidget *self){
+ gtk_widget_destroy(gtk_widget_get_toplevel(self));
+}
+
+/**yon_open_browser(GtkWidget *self, char *link)
+ * [EN]
+ * Opens browser with [link] link.
+ * [RU]
+ * Открывает браузер с [link] ссылкой.
+*/
+void yon_open_browser(GtkWidget *self, char *link){
+ yon_ubl_browser_window_open(link,TITLE_LABEL);
+}
+
+/**on_open_documentation_confirmation(GtkWidget *self, char *link)
+ * [EN]
+ * Opens confirmation window for [link] link.
+ * [RU]
+ * Открывает окно подтверждение перехода по ссылке [link].
+*/
+void on_open_documentation_confirmation(GtkWidget *self, char *link){
+ if (main_config.always_open_documentation==0){
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
+ documentation_confirmation_window *widgets = malloc(sizeof(documentation_confirmation_window));
+ widgets->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow");
+ widgets->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton");
+ widgets->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton");
+ widgets->HatText = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel");
+ widgets->HeaderText = yon_gtk_builder_get_widget(builder,"helpHeader");
+ widgets->InfoText = yon_gtk_builder_get_widget(builder,"helpText");
+ widgets->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox");
+ gtk_label_set_text(GTK_LABEL(widgets->HatText),TITLE_LABEL);
+ gtk_label_set_text(GTK_LABEL(widgets->HeaderText),HELP_TITLE_LABEL);
+ gtk_label_set_text(GTK_LABEL(widgets->InfoText),HELP_INFO_LABEL);
+ gtk_button_set_label(GTK_BUTTON(widgets->AcceptButton),OPEN_HELP_LABEL);
+ gtk_button_set_label(GTK_BUTTON(widgets->AlwaysOpenCheck),HELP_ALWAYS_OPEN_LABEL);
+ gtk_button_set_label(GTK_BUTTON(widgets->CloseButton),CANCEL_LABEL);
+ gtk_widget_show_all(widgets->Window);
+ g_signal_connect(G_OBJECT(widgets->CloseButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
+ g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link));
+ g_signal_connect(G_OBJECT(widgets->AcceptButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
+
+
+ } else {
+ yon_open_browser(self,link);
+ }
+}
+
+/**on_link(GtkWidget *self, char* uri, gpointer user_data)
+ * [EN]
+ * Signal for hadnling AboutDialog links.
+ * Connect to "activate-link" signal.
+ * [self] is AboutDialog window;
+ * [uri] is activated link;
+ * [user_data] is pointer for user data, hasn't used in standard handler;
+ * [RU]
+ * Функция для обработки сигнала нажатия на ссылку окна AboutDialog.
+ * Присоединять к сигналу "activate-link".
+ * [self] - окно AboutDialog;
+ * [uri] - ссылка, по которой совершается переход;
+ * [user_data] - указатель на любые другие данные, не используется в стандартном обработчике;
+*/
+void on_link(GtkWidget *self, char* uri, gpointer user_data){
+ gtk_widget_destroy(self);
+ on_open_documentation_confirmation(self,uri);
+}
+
+/**on_about()
+ * [EN]
+ * Function for setting up and showing AboutDialog.
+ * Connect it to "activate" signal of Documentation MenuItem.
+ * [RU]
+ * Функиця для настройки и показа окна AboutDialog.
+ * Присоединять к сигналу "activate" кнопки справки типа MenuItem.
+*/
+void on_about(){
+ GtkBuilder *builder=gtk_builder_new_from_resource(glade_path);
+ GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow");
+ GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic");
+ GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide");
+ gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application);
+ gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(window),PROJECT_HOME_LABEL);
+ gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL);
+ gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL);
+ g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),NULL);
+ gtk_widget_set_visible(hideButtonBox,0);
+ gtk_widget_destroy(hideButtonBox);
+ gtk_widget_show(window);
+}
+
+//functions
+
+void yon_load_proceed(char *command){
+ if (yon_config_load_register(command))
+ yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ else
+ yon_ubl_status_box_render(LOAD_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
+
+}
+
+void on_groups_open(){
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_groups_path);
+ groups_window *window = malloc(sizeof(groups_window));
+ window->Window = yon_gtk_builder_get_widget(builder,"GroupsWindow");
+ window->GroupsCancelButton = yon_gtk_builder_get_widget(builder,"GroupsCancelButton");
+ window->GroupsOkButton = yon_gtk_builder_get_widget(builder,"GroupsOkButton");
+
+ g_signal_connect(G_OBJECT(window->GroupsCancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
+ g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
+ gtk_widget_show(window->Window);
+}
+
+void on_user_add(){
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_user_path);
+ user_window *window = malloc(sizeof(user_window));
+ window->Window = yon_gtk_builder_get_widget(builder,"CreateUserWindow");
+ window->UserAdditionalGroupsButton = yon_gtk_builder_get_widget(builder,"UserAdditionalGroupsButton");
+ window->UserCancelButton = yon_gtk_builder_get_widget(builder,"UserCancelButton");
+ window->UserOkButton = yon_gtk_builder_get_widget(builder,"UserOkButton");
+
+ g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
+ g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_close_subwindow),NULL);
+ g_signal_connect(G_OBJECT(window->UserAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_open),NULL);
+ gtk_widget_show(window->Window);
+}
+
+void on_user_edit(){
+
+}
+
+void on_user_delete(){
+
+}
+
+// standard functions
+
+void config_init(){
+ main_config.always_open_documentation=0;
+ main_config.win_height=0;
+ main_config.win_width=0;
+ main_config.win_pos_x=0;
+ main_config.win_pos_y=0;
+ main_config.socket_id=-1;
+ main_config.save_socket_id=-1;
+ main_config.load_socket_id=-1;
+ main_config.lock_help=0;
+ main_config.lock_help=0;
+ main_config.lock_load_global=0;
+ main_config.lock_save_global=0;
+ main_config.lock_save_local=0;
+}
+
+main_window *setup_window(){
+ /* Widgets getting | Получение виджетов */
+ main_window *widgets = malloc(sizeof(main_window));
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path);
+ widgets->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
+ widgets->HatLabel = yon_gtk_builder_get_widget(builder,"headerTopic");
+ widgets->PlugBox = yon_gtk_builder_get_widget(builder,"plugBox");
+
+ widgets->HeadOverlay = yon_gtk_builder_get_widget(builder,"HeadOverlay");
+ widgets->HeadImage = yon_gtk_builder_get_widget(builder,"HeadBackgroundImage");
+ widgets->HeadBox = yon_gtk_builder_get_widget(builder,"HeaderBox");
+ widgets->HeadTitleLabel = yon_gtk_builder_get_widget(builder,"HeaderTitleLabel");
+ widgets->HeadInfoLabel = yon_gtk_builder_get_widget(builder,"HeaderInfoLabel");
+
+ widgets->StatusBox = yon_gtk_builder_get_widget(builder,"mainStatusBox");
+ widgets->StatusIcon = yon_gtk_builder_get_widget(builder,"mainStatusIcon");
+ widgets->StatusLabel = yon_gtk_builder_get_widget(builder,"mainStatusLabel");
+
+ widgets->SaveLabel = yon_gtk_builder_get_widget(builder,"headerSaveConfigLabel");
+ widgets->SaveMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalLocalConfigurationMenuItem");
+ widgets->SaveGlobalMenuItem = yon_gtk_builder_get_widget(builder,"SaveGlobalConfigurationMenuItem");
+ widgets->SaveLocalMenuItem = yon_gtk_builder_get_widget(builder,"SaveLocalConfigurationMenuItem");
+ widgets->RightBox = yon_gtk_builder_get_widget(builder,"HeaderRightBox");
+
+ widgets->LoadLabel = yon_gtk_builder_get_widget(builder,"headerLoadConfigLabel");
+ widgets->LoadGlobalMenuItem = yon_gtk_builder_get_widget(builder,"LoadGlobalConfigurationMenuItem");
+ widgets->LoadLocalMenuItem = yon_gtk_builder_get_widget(builder,"LoadLocalConfigurationMenuItem");
+ widgets->LeftBox = yon_gtk_builder_get_widget(builder,"HeaderLeftBox");
+
+ widgets->DocumentationMenuItem = yon_gtk_builder_get_widget(builder,"DocumentationMenuItem");
+ widgets->AboutMenuItem = yon_gtk_builder_get_widget(builder,"AboutMenuItem");
+
+ widgets->MainAddUserButton = yon_gtk_builder_get_widget(builder,"MainAddUserButton");
+ widgets->MainEditUserButton = yon_gtk_builder_get_widget(builder,"MainEditUserButton");
+ widgets->MainDeleteUserButton = yon_gtk_builder_get_widget(builder,"MainDeleteUserButton");
+
+ widgets->MainEditGroupsButton = yon_gtk_builder_get_widget(builder,"MainEditGroupsButton");
+
+
+ if (main_config.lock_load_global == 1){
+ gtk_widget_set_sensitive(widgets->LoadGlobalMenuItem,0);
+ }
+ if (main_config.lock_save_global == 1){
+ gtk_widget_set_sensitive(widgets->SaveGlobalMenuItem,0);
+ gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
+ }
+ if (main_config.lock_save_local == 1){
+ gtk_widget_set_sensitive(widgets->SaveLocalMenuItem,0);
+ gtk_widget_set_sensitive(widgets->SaveMenuItem,0);
+ }
+
+ /* Signal connection | Присоединение сигналов */
+ g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
+ g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),WIKI_LINK);
+ g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),NULL);
+ g_signal_connect(G_OBJECT(widgets->MainAddUserButton),"clicked",G_CALLBACK(on_user_add),NULL);
+ g_signal_connect(G_OBJECT(widgets->MainEditUserButton),"clicked",G_CALLBACK(on_user_edit),NULL);
+ g_signal_connect(G_OBJECT(widgets->MainDeleteUserButton),"clicked",G_CALLBACK(on_user_delete),NULL);
+ g_signal_connect(G_OBJECT(widgets->MainEditGroupsButton),"clicked",G_CALLBACK(on_groups_open),NULL);
+
+
+ gtk_widget_show(widgets->Window);
+ return widgets;
+}
+
int main(int argc, char *argv[]){
+ local=setlocale(LC_ALL, "");
+ textdomain (LocaleName);
+ config_init();
+ int option_index=0;
+ int show_help=0;
+ int debug_mode=0;
+ {
+ struct option long_options[] = {
+ {"help", 0, 0, 'h'},
+ {"version", 0, 0, 'V'},
+ {"lock-help", 0,0, 1},
+ {"lock-save", 0,0, 2},
+ {"lock-save-local", 0,0, 3},
+ {"lock-save-global", 0,0, 4},
+ {"lock-load-global", 0,0, 5},
+ {"socket-id", 1, 0, 's'},
+ {"socket-ext-id", 1,0, 'e'},
+ {"socket-trd-id", 1,0, 't'},
+ {"debug", 0,0, 'd'},
+ { NULL, 0, NULL, 0 }
+ };
+ for (int i=0;iHeadOverlay,widgets->HeadBox,widgets->HeadImage,banner_path);
+
+ yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel);
+ if (getuid()!=0)
+ yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
+ else
+ yon_ubl_status_box_render(TITLE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
+ yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,main_config.socket_id,main_config.load_socket_id,main_config.save_socket_id);
+ yon_window_config_setup(GTK_WINDOW(widgets->Window));
+ yon_window_config_load(config_path);
+ GtkCssProvider *css=gtk_css_provider_new();
+ gtk_css_provider_load_from_resource(css,CssPath);
+ gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
+ GTK_STYLE_PROVIDER(css),
+ -1);
gtk_main();
}
\ No newline at end of file
diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h
index 347bd68..afd0497 100644
--- a/source/ubl-settings-usergroups.h
+++ b/source/ubl-settings-usergroups.h
@@ -1,2 +1,119 @@
+#include
+#include
+#include "ubl-utils.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "ubl-cmake.h"
+#ifdef WEBKIT_FOUND
+ #include
+#endif
+#include "ubl-strings.h"
-#define glade_path "/usr/share/ubl-settings-usergroups/ui/ubl-settings-usergroups.glade"
\ No newline at end of file
+#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-usergroups"
+
+#define _(String) gettext(String)
+
+#define glade_path "/com/ublinux/ui/ubl-settings-usergroups.glade"
+#define glade_user_path "/com/ublinux/ui/ubl-settings-usergroups-user.glade"
+#define glade_groups_path "/com/ublinux/ui/ubl-settings-usergroups-group.glade"
+#define banner_path "/com/ublinux/images/ubl-settings-usergroups-banner.png"
+#define CssPath "/com/ublinux/css/ubl-settings-usergroups.css"
+#define config_path yon_char_unite("/home/",yon_ubl_root_user_get(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
+
+#define yon_col(mean) yon_char_append(mean,":")
+
+#define LocalePath "/usr/share/locale"
+#define LocaleName "ubl-settings-usergroups"
+typedef char* string;
+string version_application;
+
+char *local;
+
+typedef struct {
+ int always_open_documentation;
+ int win_pos_x;
+ int win_pos_y;
+ int win_width;
+ int win_height;
+
+ int socket_id;
+ int load_socket_id;
+ int save_socket_id;
+
+ int lock_help;
+ int lock_save_local;
+ int lock_save_global;
+ int lock_load_global;
+} config;
+
+typedef struct {
+ GtkWidget *Window;
+ GtkWidget *HatLabel;
+ GtkWidget *PlugBox;
+
+ GtkWidget *HeadOverlay;
+ GtkWidget *HeadImage;
+ GtkWidget *HeadBox;
+ GtkWidget *HeadTitleLabel;
+ GtkWidget *HeadInfoLabel;
+
+ GtkWidget *StatusBox;
+ GtkWidget *StatusIcon;
+ GtkWidget *StatusLabel;
+
+ GtkWidget *SaveLabel;
+ GtkWidget *SaveMenuItem;
+ GtkWidget *SaveGlobalMenuItem;
+ GtkWidget *SaveLocalMenuItem;
+ GtkWidget *RightBox;
+
+ GtkWidget *LoadLabel;
+ GtkWidget *LoadGlobalMenuItem;
+ GtkWidget *LoadLocalMenuItem;
+ GtkWidget *LeftBox;
+
+ GtkWidget *DocumentationMenuItem;
+ GtkWidget *AboutMenuItem;
+
+ GtkWidget *MainAddUserButton;
+ GtkWidget *MainEditUserButton;
+ GtkWidget *MainDeleteUserButton;
+
+ GtkWidget *MainEditGroupsButton;
+
+
+
+} main_window;
+
+
+typedef struct {
+ GtkWidget *Window;
+
+ GtkWidget *HatText;
+ GtkWidget *HeaderText;
+ GtkWidget *InfoText;
+ GtkWidget *AlwaysOpenCheck;
+
+ GtkWidget *CloseButton;
+ GtkWidget *AcceptButton;
+} documentation_confirmation_window;
+
+typedef struct {
+ GtkWidget *Window;
+ GtkWidget *GroupsCancelButton;
+ GtkWidget *GroupsOkButton;
+} groups_window;
+
+typedef struct {
+ GtkWidget *Window;
+ GtkWidget *UserAdditionalGroupsButton;
+ GtkWidget *UserCancelButton;
+ GtkWidget *UserOkButton;
+} user_window;
+
+main_window *setup_window();
\ No newline at end of file
diff --git a/source/ubl-strings.h b/source/ubl-strings.h
new file mode 100644
index 0000000..56da4ea
--- /dev/null
+++ b/source/ubl-strings.h
@@ -0,0 +1,61 @@
+#define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL)
+#define HELP_LABEL yon_char_unite(_("ubl-settings-usergroups version:")," ", version_application,"\n",_("Users and groups"),"\n",_("Usage:"), " ubl-settings-usergroups ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n",NULL)
+
+#define TITLE_LABEL _("Users and groups")
+#define TITLE_INFO_LABEL _("System users and groups configuration")
+
+#define SUCCESS_LABEL _("Operation succeeded")
+#define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked")
+
+#define ABOUT_LABEL _("About")
+#define DOCUMENTATION_LABEL _("Documentation")
+
+#define SAVE_LOCAL_LABEL _("Save to local configuration")
+#define SAVE_GLOBAL_LABEL _("Save to global configuration")
+#define SAVE_CONFIGURATION_LABEL _("Save configuration")
+#define SAVE_LABEL _("Save")
+
+#define LOAD_LOCAL_LABEL _("Load local configuration")
+#define LOAD_GLOBAL_LABEL _("Load global configuration")
+#define LOAD_LABEL _("Load")
+
+#define CANCEL_LABEL _("Cancel")
+
+#define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?")
+#define HELP_INFO_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.")
+#define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation")
+#define OPEN_HELP_LABEL _("Open documentation")
+#define PROJECT_HOME_LABEL _("Project Home Page")
+#define NOTHING_CHOSEN_LABEL _("Nothing were chosen")
+
+
+#define GLOBAL_LOAD_SUCCESS_LABEL _("Global configuration loading succseeded.")
+#define LOCAL_LOAD_SUCCESS_LABEL _("Local configuration loading succseeded.")
+#define LOAD_FAILED_LABEL _("Config loading failed")
+
+#define GLOBAL_LOCAL_SAVE_SUCCESS_LABEL _("Local and global configuration saving succseeded.")
+#define GLOBAL_SAVE_SUCCESS_LABEL _("Global configuration saving succseeded.")
+#define LOCAL_SAVE_SUCCESS_LABEL _("Local configuration saving succseeded.")
+
+#define DEFAULT_USER_GROUPS_LABEL _("Default user groups:")
+#define DEFAULT_USER_NAME_LABEL _("Default user name (if there's no another):")
+#define USER_1000_IS_ADMIN_LABEL _("User with ID 1000 is administrator")
+#define DEFAULT_USER_PASSWORD_LABEL _("Default user password:")
+#define ROOT_USER_PASSWORD_LABEL _("Root user password:")
+#define PASSWORD_HASH_ALGORYTHM_LABEL _("Password hash algorythm:")
+
+#define UID_LABEL _("UID")
+#define LOGIN_LABEL _("Login")
+#define PASSWORD_LABEL _("Password")
+#define USER_NAME_LABEL _("User name")
+
+#define UID_USER_LABEL _("UID:")
+#define USERNAME_USER_LABEL _("User name:")
+#define LOGIn_USER_LABEL _("Login:")
+#define PASSWORD_USER_LABEL _("Password:")
+#define DEFAULT_USER_LABEL _("Default")
+#define MAIN_GROUP_USER_LABEL _("Main group:")
+#define ADDITIONAL_GROUPS_USER_LABEL _("Additional groups")
+#define PASSWORD_HASH_USER_LABEL _("Password hash algorythm:")
+#define SYNC_SAMBA_USER_LABEL _("Sync with SAMBA user")
+#define EXTRA_OPTIONS_USER_LABEL _("Extra options:")
\ No newline at end of file
diff --git a/source/ubl-utils.c b/source/ubl-utils.c
new file mode 100644
index 0000000..341e091
--- /dev/null
+++ b/source/ubl-utils.c
@@ -0,0 +1,1637 @@
+#include "ubl-utils.h"
+
+// dictionary functions
+
+/**yon_dictionary_create_empty():
+ * [EN]
+ * Creates and returns empty dictionary
+ * [RU]
+ * Создаёт и возвращает пустой словарь.
+ */
+dictionary *yon_dictionary_new()
+{
+ dictionary *dict = malloc(sizeof(dictionary));
+ dict->data = NULL;
+ dict->key = NULL;
+ dict->next = NULL;
+ dict->prev = NULL;
+ dict->first = dict;
+ dict->data_type = DICTIONARY_OTHER_TYPE;
+ return dict;
+}
+
+/**yon_dictionary_copy_deep(dictionary *dict)
+ * [EN]
+ *
+ * [RU]
+ * Создаёт и возвращает копию элемента словаря [dict]
+*/
+dictionary *yon_dictinoary_copy(dictionary *dict){
+ dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data);
+ dct->data_type= dict->data_type;
+}
+
+/**yon_dictionary_copy_deep(dictionary *dict)
+ * [EN]
+ *
+ * [RU]
+ * Создаёт полную копию словаря [dict] и возвращает первый элемент
+*/
+dictionary *yon_dictionary_copy_deep(dictionary *dict){
+ dictionary *dct = NULL;
+ dictionary *newone=NULL;
+ for_dictionaries(dct,dict){
+ yon_dictionary_add_or_create_if_exists_with_data(newone,dct->key,dct->data);
+ newone->data_type=dct->data_type;
+ }
+ return newone->first;
+}
+
+int yon_dictionary_set_data(dictionary *dict, void *data){
+ dict->data=data;
+}
+
+int yon_dictionary_set_key(dictionary *dict, char *key){
+ dict->key=key;
+}
+
+int yon_dictionary_set(dictionary *dict, char *key, void *data){
+ dict->key=key;
+ dict->data=data;
+}
+
+int yon_dictionary_empty(dictionary *dict){
+ dict->data=NULL;
+ dict->data_type=DICTIONARY_OTHER_TYPE;
+}
+
+/**yon_dictionary_switch_to_last(dictionary **dict)
+ * [EN]
+ *
+ * [RU]
+ * Переключает словарь [dict] на последний элемент.
+*/
+void yon_dictionary_switch_to_last(dictionary **dict)
+{
+ dictionary *dct=NULL, *dact=*dict;
+ for_dictionaries(dct,dact);
+}
+
+/**yon_dictionary_create_conneced(dictionary *targetdict)
+ * [EN]
+ *
+ * [RU]
+ * Создаёт новый элемент словаря [targetdict]
+*/
+dictionary *yon_dictionary_append(dictionary *targetdict)
+{
+ targetdict = yon_dictionary_get_last(targetdict);
+ targetdict->next = yon_dictionary_new();
+ targetdict->next->prev = targetdict;
+ targetdict->next->first = targetdict->first;
+ targetdict->next->data_type = DICTIONARY_OTHER_TYPE;
+ return targetdict->next;
+}
+
+/**yon_dictionary_get_last(dictionary *dict)
+ * [EN]
+ *
+ * [RU]
+ * Возвращает последний элемент словаря [dict].
+ * В отличае от yon_dictionary_switch_to_last()
+ * словарь [dict] остаётся на прежнем элементе.
+*/
+dictionary *yon_dictionary_get_last(dictionary *dict)
+{
+ if (dict->next){
+ dictionary *dct = NULL;
+ for_dictionaries(dct,dict);
+ return dct;
+ } else return dict;
+}
+
+/**yon_dictionary_switch_places(dictionary *dict, int aim)
+ * [EN]
+ *
+ * [RU]
+ * Меняет элемент словаря [dict] местами с другим элементом.
+ * если [aim]<0 элемент меняется местами с левым элементом;
+ * если [aim]>0 элемент меняется местами с правым элементом;
+*/
+dictionary *yon_dictionary_swap(dictionary *dict, int aim)
+{
+ if (aim < 0)
+ {
+ if (dict->prev)
+ {
+ if (dict->prev->prev)
+ {
+ dictionary *next = dict->next, *prev = dict->prev, *preprev = prev->prev;
+ if (next)
+ {
+ preprev->next = dict;
+ dict->prev = preprev;
+ dict->next = prev;
+ prev->prev = dict;
+ prev->next = next;
+ next->prev = prev;
+ }
+ else
+ {
+ preprev->next = dict;
+ dict->prev = preprev;
+ dict->next = prev;
+ prev->prev = dict;
+ prev->next = NULL;
+ }
+ return prev;
+ }
+ else
+ {
+ dictionary *next = dict->next, *prev = dict->prev;
+ if (next)
+ {
+ yon_dictionary_make_first(dict);
+ dict->prev = NULL;
+ dict->next = prev;
+ prev->prev = dict;
+ prev->next = next;
+ next->prev = prev;
+ }
+ else
+ {
+ dict->prev = NULL;
+ dict->next = prev;
+ prev->prev = dict;
+ prev->next = NULL;
+ }
+ return prev;
+ }
+ }
+ }
+ else if (aim > 0)
+ {
+ if (dict->next)
+ {
+ if (dict->next->next)
+ {
+ dictionary *next = dict->next, *prev = dict->prev, *afnext = next->next;
+ if (prev)
+ {
+ prev->next = next;
+ next->prev = prev;
+ next->next = dict;
+ dict->prev = next;
+ dict->next = afnext;
+ afnext->prev = dict;
+ }
+ else
+ {
+ yon_dictionary_make_first(next);
+ next->prev = NULL;
+ next->next = dict;
+ dict->prev = next;
+ dict->next = afnext;
+ afnext->prev = dict;
+ }
+ return next;
+ }
+ else
+ {
+ dictionary *next = dict->next, *prev = dict->prev;
+ if (prev)
+ {
+ prev->next = next;
+ next->prev = prev;
+ next->next = dict;
+ dict->prev = next;
+ dict->next = NULL;
+ }
+ else
+ {
+ next->prev = NULL;
+ next->next = dict;
+ dict->prev = next;
+ dict->next = NULL;
+ }
+ }
+ }
+ }
+}
+
+/**yon_dictionary_make_first(dictionary *dict)
+ * [EN]
+ *
+ * [RU]
+ * Устанавливает указатель первого элемента словаря [dict]
+ * на текущий элемент. Не использовать.
+*/
+void yon_dictionary_make_first(dictionary *dict)
+{
+ for (dictionary *dct = dict->first; dct != NULL; dct = dct->next)
+ {
+ dct->first = dict;
+ }
+}
+
+/**yon_dictionary_make_nth(dictionary *dict, int nth)
+ * [EN]
+ *
+ * [RU]
+ * Перемещает элемент словаря [dict] на позицию [nth].
+*/
+void yon_dictionary_make_nth(dictionary *dict, int nth)
+{
+ dictionary *dct = dict->first;
+ for (int i = 0; i < nth; i++)
+ {
+ if (dct == NULL)
+ return;
+ else
+ dct = dct->next;
+ }
+ yon_dictionary_rip(dict);
+ dictionary *prev = dct->prev;
+ prev->next = dict;
+ dict->prev = prev;
+ dict->next = dct;
+ dct->prev = dict;
+}
+
+/**yon_dictionary_create_with_data(char *key, void *data)
+ * [EN]
+ *
+ * [RU]
+ * Создаёт новый словарь с ключом [key] и указателем на данные [data]
+*/
+dictionary *yon_dictionary_new_with_data(char *key, void *data)
+{
+ dictionary *dct = yon_dictionary_new();
+ dct->key = yon_char_new(key);
+ dct->data = data;
+ dct->data_type = DICTIONARY_OTHER_TYPE;
+ return dct;
+}
+
+/** void *yon_dictionary_free_all(dictionary *dictionary,void *data_manipulation)
+ * [EN]
+ * Frees whole [dictionary] and activates [data_manipulation] function if not NULL with [dictionary]->data argument for each dictionary.
+ * [RU]
+ * Освобождает память для всех элементов словаря [dictionary] и активирует функцию [data_manipulation], если она была передана, с аргументом [dictionary]->data на каждый элемент словаря.
+*/
+void *yon_dictionary_free_all(dictionary *dictionary_to_free,void (*data_manipulation)(void*)){
+ dictionary *dict=NULL;
+ for_dictionaries(dict,dictionary_to_free){
+ if(data_manipulation)
+ data_manipulation(dict->data);
+ if(dict->prev)
+ free(dict->prev);
+ }
+ free(dict);
+ return NULL;
+}
+
+/**yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data)
+ * [EN]
+ *
+ * [RU]
+ * Создаёт новый элемент словаря, присоединяемый в конец словаря [dict]
+ * с ключом [key] и указателем на данные [data]
+*/
+dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data)
+{
+ dictionary *dct = yon_dictionary_append(dict);
+ dct->key = yon_char_new(key);
+ dct->data = data;
+ dct->data_type = DICTIONARY_OTHER_TYPE;
+ return dct;
+}
+
+/**yon_dictionary_connect(dictionary *old, dictionary *toconnect)
+ * [EN]
+ *
+ * [RU]
+ * Присоединяет словарь [toconnect] в конец словаря [old].
+*/
+dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect)
+{
+ dictionary *dict = yon_dictionary_get_last(old);
+ dict->next = toconnect;
+ toconnect->prev = dict;
+ toconnect->first = dict->first;
+ return toconnect;
+}
+
+/**yon_dictionary_get(dictionary **dict, char *key)
+ * [EN]
+ *
+ * [RU]
+ * Возвращает элемент словаря [dict] с ключом [key].
+ * Если такого элемента не было обнаружено, возвращается NULL
+*/
+dictionary *yon_dictionary_get(dictionary **dict, char *key)
+{
+ dictionary *dct = *dict;
+ for (dictionary *pointer = dct->first; pointer != NULL; pointer = pointer->next)
+ {
+ if (strcmp(pointer->key, key) == 0)
+ {
+ *dict = pointer;
+ return pointer;
+ }
+ }
+ return NULL;
+}
+
+/**yon_dictionary_rip(dictionary *dict)
+ * [EN]
+ *
+ * [RU]
+ * Вырезает элемент из словаря и возвращает вырезанный элемент.
+*/
+dictionary *yon_dictionary_rip(dictionary *dict)
+{
+ if (!dict->next&&!dict->prev) return NULL;
+ else if (!dict->next)
+ {
+ dictionary *prev = dict->prev;
+ if (prev)
+ {
+ prev->next = NULL;
+ return prev;
+ }
+ else
+ return dict;
+ }
+ else if (!dict->prev)
+ {
+ dictionary *next = dict->next;
+ if (next)
+ {
+ yon_dictionary_make_first(next);
+ next->prev = NULL;
+ return next;
+ }
+ else
+ return dict;
+ }
+ else
+ {
+ dictionary *next = dict->next, *prev = dict->prev;
+ next->prev = prev;
+ prev->next = next;
+ return next;
+ }
+}
+
+/**yon_dictionary_get_nth(dictionary *dict, int place)
+ * [EN]
+ *
+ * [RU]
+ * Возвращает [place]-й элемент словаря [dict]
+*/
+dictionary *yon_dictionary_get_nth(dictionary *dict, int place)
+{
+ if (dict){
+ dict = dict->first;
+ int i = 0;
+ for (i = 0; i < place; i++)
+ if (dict->next)
+ dict = dict->next;
+ else
+ break;
+ if (i == place)
+ return dict;
+ else
+ return NULL;
+ } else return NULL;
+}
+
+// char functions
+
+/**[EN]
+ *
+ * creates new char string by combining two char strings.
+ */
+char *yon_char_append(char *source, char *append)
+{
+ if (source && append)
+ {
+ int size = strlen(source) + strlen(append) + 1;
+ char *final = malloc(size);
+ memset(final, 0, size);
+ if (strstr(source, "%%"))
+ sprintf(final, source, append);
+ else
+ sprintf(final, "%s%s", source, append);
+ return final;
+ }
+ else
+ return NULL;
+}
+
+/**[EN]
+ *
+ * creates new char string by copying another char.
+ */
+char *yon_char_new(char *chr)
+{
+ if (chr){
+ char *newchar = malloc(strlen(chr) + 1);
+ memset(newchar, 0, strlen(chr) + 1);
+ memcpy(newchar, chr, strlen(chr));
+ return newchar;
+ } else
+ return NULL;
+}
+
+// char *yon_char_unite(char *source, ...)
+
+char *yon_char_unite(char *source, ...){
+ va_list arglist;
+ char *new_char=NULL;
+ char *unite_char=NULL;
+ new_char=yon_char_new(source);
+ va_start(arglist,source);
+ unite_char = va_arg(arglist,char*);
+ while(unite_char){
+ new_char = yon_char_append(new_char,unite_char);
+ unite_char = va_arg(arglist,char*);
+ }
+ va_end(arglist);
+ return new_char;
+}
+
+/**yon_cut(char *source, int size, int startpos)
+ * [EN]
+ * cuts source string by size length from startpos position.
+ */
+char *yon_cut(char *source, int size, int startpos)
+{
+ char *cut = NULL;
+ cut = malloc(size + 1);
+ memset(cut, 0, size + 1);
+ memcpy(cut, source + startpos, size);
+ return cut;
+}
+
+/**yon_char_divide(char *source, int dividepos)
+ * [EN]
+ * divides source string in dividepos position,
+ * returning left part of divided string and
+ * inserting right part to source string.
+ */
+char *yon_char_divide(char *source, int dividepos)
+{
+ char *cut = malloc(dividepos + 1);
+ memset(cut, 0, dividepos + 1);
+ memcpy(cut, source, dividepos);
+ char *left = malloc(strlen(source) - strlen(cut));
+ memset(left, 0, strlen(source) - strlen(cut));
+ memcpy(left, source + dividepos + 1, (strlen(source) - dividepos));
+ memset(source, 0, strlen(source));
+ memcpy(source, left, strlen(left));
+ return cut;
+}
+
+int yon_char_find_count(char *source, char *find){
+ char *working_string=yon_char_new(source);
+ int i=0;
+ int size=0;
+ int pos=0;
+ config_str rtn = yon_char_parse(working_string,&size,"\n");
+ for (int j=0;j= 10; i++)
+ {
+ convert_check = convert_check / 10;
+ }
+ char *ch = g_malloc0(i * sizeof(char) + 1);
+ sprintf(ch, "%d", int_to_convert);
+ return ch;
+}
+
+/**yon_char_replace(char *source, char *find, char*replace)
+ * [EN]
+ *
+ * [RU]
+ * Заменяет в строке [source] все вхождения строки [find] на [replace]
+*/
+char *yon_char_replace(char *source, char *find, char*replace){
+ char *final=NULL;
+ char *temp=NULL;
+ if(!strstr(replace,find)){
+ while ((final=strstr(source,find))){
+ temp=malloc(strlen(source)-strlen(final));
+ memset(temp,0,strlen(source)-strlen(final)+strlen(replace));
+ memcpy(temp,source,strlen(source)-strlen(final));
+ temp=yon_char_append(temp,replace);
+ source=yon_char_append(temp,final+1);
+ }
+ return source;
+ }
+}
+
+/**[EN]
+ * char **yon_char_parse(char *parameters, int *size, char *divider)
+ * Parses string [parameters], divided by [divider],
+ * then returns parsed string array and sets [size] to
+ * size of returned array
+*/
+char **yon_char_parse(char *parameters, int *size, char *divider){
+ char **string=NULL;
+ int i=1;
+ string=malloc(sizeof(char*));
+ char *paramline=yon_char_new(parameters);
+ char *param;
+ while ((param=yon_char_divide_search(paramline,divider,1))){
+ string=realloc(string,sizeof(char*)*i);
+ string[i-1]=yon_char_new(param);
+ i++;
+ if (strcmp(param,paramline)==0) break;
+ }
+ string=realloc(string,sizeof(char*)*i);
+ string[i-1]=yon_char_new(paramline);
+ i++;
+ // printf("%d\n",i);
+ *size=i-1;
+ return string;
+
+}
+
+/**yon_char_parsed_rip(char **char_string, int *size, int item_to_delete)
+ * [EN]
+ *
+ * [RU]
+ * Удаляет элемент [item_to_delete] из массива строк [char_string], размера [size]
+ * Возвращает получившийся массив, в [size] загружается размер нового массива.
+*/
+char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete){
+ char **new_char_parsed=NULL;
+ new_char_parsed=malloc(sizeof(char*)*((*size)-1));
+ int flag = 0;
+ for (int i=0;i < (*size);i++){
+ if (i==item_to_delete) {
+ flag = 1;
+ }
+ if (flag == 0) {
+ new_char_parsed[i]=yon_char_new(char_string[i]);
+ }
+ else if (flag == 1 && i!=item_to_delete) {
+ new_char_parsed[i-1]=yon_char_new(char_string[i]);
+ }
+ }
+ (*size)=(*size)-1;
+ return new_char_parsed;
+}
+
+/**yon_char_parsed_check_exist(char **parameters, int size, char *param)
+ * [EN]
+ * Checks if [parameters] string array of length [size]
+ * has [param] element;
+ * [RU]
+ * Проверяет есть ли в массиве строк [parameters], размера [size]
+ * элемент [param]
+*/
+int yon_char_parsed_check_exist(char **parameters, int size, char *param){
+
+ for (int i=0;id_name);
+ file = fopen(path, "r");
+ if (strlen(de->d_name) > 9)
+ {
+ char *extension = strstr(path, ".");
+ if (extension != NULL)
+ {
+ if (strcmp(extension, ".desktop") == 0)
+ {
+ apps tempapp;
+ GKeyFile *gfile = g_key_file_new();
+ GError *err = NULL;
+ g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
+ char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err);
+ if (err)
+ {
+ printf("%s\n", err->message);
+ }
+ if (strcmp(Type, "Application") == 0)
+ tempapp.Type = 1;
+ else if (strcmp(Type, "pyApplication") == 0)
+ tempapp.Type = 2;
+ else
+ continue;
+ tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL);
+ if (tempapp.Name == NULL)
+ continue;
+ tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL);
+ if (tempapp.Categories == NULL)
+ continue;
+ tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL);
+ if (tempapp.Exec == NULL)
+ continue;
+ tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL);
+ if (tempapp.Icon == NULL)
+ continue;
+ tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL);
+ if (!tempapp.Pluggable)
+ tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL);
+ if (tempapp.Pluggable)
+ tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL);
+ if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0)
+ if (size == 0)
+ {
+ applist = (apps *)malloc(size + 1 * sizeof(apps));
+ applist[0].Name = yon_char_new(tempapp.Name);
+ applist[0].Categories = yon_char_new(tempapp.Categories);
+ applist[0].Exec = yon_char_new(tempapp.Exec);
+ applist[0].Icon = yon_char_new(tempapp.Icon);
+ applist[0].Type = tempapp.Type;
+ applist[0].Pluggable = tempapp.Pluggable;
+ applist[0].DualPluggable = tempapp.DualPluggable;
+ size++;
+ }
+ else
+ {
+ applist = (apps *)realloc(applist, (size + 1) * sizeof(apps));
+ applist[size].Name = yon_char_new(tempapp.Name);
+ applist[size].Categories = yon_char_new(tempapp.Categories);
+ applist[size].Exec = yon_char_new(tempapp.Exec);
+ applist[size].Icon = yon_char_new(tempapp.Icon);
+ applist[size].Pluggable = tempapp.Pluggable;
+ applist[size].DualPluggable = tempapp.DualPluggable;
+ applist[size].Type = tempapp.Type;
+ size++;
+ }
+ }
+ }
+ }
+ }
+ }
+ *sizef = size;
+ return applist;
+};
+
+void yon_apps_sort(apps *applist, int size)
+{
+ apps tmp;
+ if (size > 2)
+ {
+ for (int i = 1; i < size; i++)
+ {
+ for (int j = 1; j < size; j++)
+ {
+ if (strcmp(applist[j].Name, applist[j - 1].Name) < 0)
+ {
+ tmp = applist[j];
+ applist[j] = applist[j - 1];
+ applist[j - 1] = tmp;
+ };
+ }
+ };
+ }
+};
+
+apps *yon_apps_get_by_name(apps *applist, char *name, int size)
+{
+ for (int i = 0; i < size; i++)
+ {
+ if (strcmp(applist[i].Name, name) == 0)
+ return &applist[i];
+ }
+ return NULL;
+};
+
+//config functions
+
+/**yon_config_load_register(char *command)
+ * [EN]
+ *
+ * [RU]
+ * Выполняет команду [command].
+ * Полученные данные парсятся и регистрируются в конфиг.
+*/
+int yon_config_load_register(char *command){
+ if (__yon__config__strings){
+ __yon__config__strings = yon_dictionary_free_all(__yon__config__strings,NULL);
+ }
+ FILE *output = popen(command, "r");
+ char **output_strings = NULL;
+ output_strings = malloc(sizeof(char));
+ int i = 0;
+ char str[4096];
+ memset(str, 0, 4096);
+ while (fgets(str, 4096, output))
+ {
+ if (strcmp(str, "") != 0&& strcmp(str,"(null)\n")!=0)
+ {
+ char *key = yon_char_divide_search(str,"=",-1);
+ yon_dictionary_add_or_create_if_exists_with_data(__yon__config__strings,key,str);
+ __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
+ }
+ }
+ check_config
+ return 0;
+ else return 1;
+}
+
+/**yon_config_remove_by_key(char *key)
+ * [EN]
+ *
+ * [RU]
+ * Удаляет параметр конфига по ключу [key]
+*/
+int yon_config_remove_by_key(char *key){
+ check_config{
+ dictionary *dict = yon_dictionary_get(&__yon__config__strings,key);
+ if (dict){
+ yon_dictionary_rip(dict);
+ return 1;
+ }else return 0;
+ }
+ return 0;
+}
+
+/**yon_config_remove_by_data(void *data)
+ * [EN]
+ *
+ * [RU]
+ * Производит поиск по конфигу на наличие параметра со значением [data] и удаляет найденное значение из конфига.
+*/
+int yon_config_remove_by_data(void *data){
+ check_config{
+ dictionary *dict = NULL;
+ for_dictionaries(dict,__yon__config__strings){
+ if (dict->data==data){
+ yon_dictionary_rip(dict);
+ return 1;
+ }
+ }
+ return 0;
+ }
+ return 0;
+}
+
+/**yon_config_remove_element(char *key, char *deleted)
+ * [EN]
+ *
+ * [RU]
+ * Удаляет элемент [deleted] из массива параметров с ключом [key]
+*/
+int yon_config_remove_element(char *key, char *deleted){
+ check_config{
+ dictionary *dict = yon_dictionary_get(&__yon__config__strings,key);
+ char *data = (char*)dict->data;
+ char *found = strstr(data,deleted);
+ int size=strlen(data)-strlen(found)+1;
+ char *new_data = malloc(size);
+ memset(new_data,0,size);
+ if (strlen(found)!=strlen(deleted)){
+ memcpy(new_data,data,size-1);
+ new_data = yon_char_append(new_data,found+strlen(deleted)+1);
+ } else {
+ memcpy(new_data,data,size-2);
+ new_data = yon_char_append(new_data,found+strlen(deleted));
+ }
+ dict->data=(void*)(new_data);
+ free(data);
+ dict->flag1=1;
+ return 1;
+ } else return 0;
+}
+
+/**yon_config_get_by_key(char *key)
+ * [EN]
+ *
+ * [RU]
+ * Возвращает значение параметра конфига с ключом [key]
+*/
+void *yon_config_get_by_key(char *key){
+ check_config{
+ dictionary *dict = NULL;
+ for_dictionaries(dict, __yon__config__strings){
+ if (strcmp(dict->key,key)==0){
+ return dict->data;
+ }
+ }
+ }
+ return NULL;
+}
+
+/**yon_config_get_key_by_data(char *data)
+ * [EN]
+ *
+ * [RU]
+ * Возвращает ключ параметра конфига со значением [data].
+ * Если параметр с таким значением не найден, возвращается NULL
+*/
+char *yon_config_get_key_by_data(char *data){
+ check_config{
+ dictionary *dict = NULL;
+ for_dictionaries(dict, __yon__config__strings){
+ if (strcmp(((char*)dict->data),data)==0){
+ return dict->key;
+ }
+ }
+ }
+ return NULL;
+}
+
+/**yon_config_set(char *key, void *data)
+ * [EN]
+ *
+ * [RU]
+ * Производит поиск по конфигу и заменяет значение параметра с ключом [key] на новое значение [data];
+*/
+int yon_config_set(char *key, void *data){
+ check_config{
+ dictionary *dict = yon_dictionary_get(&__yon__config__strings,key);
+ dict->data=data;
+ return 1;
+ } else return 0;
+}
+
+/**yon_config_clean()
+ * [EN]
+ * Erase all parameters from config;
+ * [RU]
+ * Удаляет все параметры из конфига;
+*/
+int yon_config_clean(){
+ check_config{
+ __yon__config__strings = yon_dictionary_free_all(__yon__config__strings, NULL);
+ return 1;
+ }
+ else return 0;
+}
+
+/**yon_config_register(char *key, void *data)
+ * [EN]
+ *
+ * [RU]
+ * Регистрирует новый параметр конфига.
+ * [key] - ключ параметра;
+ * [data] - значение параметра;
+*/
+void yon_config_register(char *key, void *data){
+ yon_dictionary_add_or_create_if_exists_with_data(__yon__config__strings,key,data);
+ __yon__config__strings->data_type=DICTIONARY_CHAR_TYPE;
+}
+
+/**yon_config_load(char *command, int *str_len)
+ * [EN]
+ *
+ * [RU]
+ * Выполняет команду [command] и возвращает распаршеный результат выполнения команды.
+ * В [str_len] возвращается длина возвращаемого массива
+*/
+config_str yon_config_load(char *command, int *str_len){
+ FILE *output = popen(command, "r");
+ char **output_strings = NULL;
+ output_strings = malloc(sizeof(char));
+ int i = 0;
+ char str[4096];
+ memset(str, 0, 4096);
+ while (fgets(str, 4096, output))
+ {
+ if (strcmp(str, "") != 0)
+ {
+ output_strings = realloc(output_strings, sizeof(char *) * (i + 1));
+ // printf("%s\n", str);
+ output_strings[i] = NULL;
+ output_strings[i] = yon_char_new(str);
+ memset(str, 0, 4096);
+ i++;
+ }
+ }
+ if (i>0){
+ *str_len = i;
+ return output_strings;
+ } else{
+ *str_len=-1;
+ return NULL;
+ }
+}
+
+/**int yon_config_save(char *command)
+ * [EN]
+ * Saves config with [command]
+ * [RU]
+ * Выполняет команду [command], добавляя в конец все записи конфига в таком виде:
+ * [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]"
+*/
+int yon_config_save(char *command){
+ check_config{
+ dictionary *dict = NULL;
+ for_dictionaries(dict,__yon__config__strings){
+ command = yon_char_unite(command, " ", yon_dictionary_get_data(dict,char*), NULL);
+ }
+ if (popen(command, "r")) return 1;
+ else return 0;
+ } else return 0;
+}
+
+/**yon_config_get_all(int *size)
+ * [EN]
+ *
+ * [RU]
+ * Возвращает массив со всеми параметрами конфига, оканчивающаяся NULL
+ * [size] - указатель, в который выгружается длина массива
+*/
+config_str yon_config_get_all(int *size){
+ check_config{
+ *size = 1;
+ config_str conf = NULL;
+ dictionary *dict = NULL;
+ for_dictionaries(dict,__yon__config__strings){
+ conf = yon_remalloc(conf,sizeof(char*)*(*size));
+ conf[(*size)-1] = yon_char_unite(dict->key,"=",(char*)dict->data,NULL);
+ size++;
+ }
+ conf = yon_remalloc(conf,sizeof(char*)*(*size+1));
+ conf[*size] = NULL;
+ return conf;
+ } else return NULL;
+}
+
+/**[EN]
+ * int yon_config_save(char *command)
+ * Saves config with [command]
+ * [RU]
+ * Выполняет команду [command]
+*/
+// int yon_config_save(char *command)
+// {
+// FILE *output = popen(command, "r");
+// return 1;
+// }
+
+/**char *yon_config_get_parameter(config parameters, int size, char *param)
+ * [EN]
+ * Gets parameter [param] from parameter list [parameters] of size [size];
+ * or NULL if nothing were found
+ * [RU]
+ * Возвращает параметр [param] из массива строк [parameters] размером [size]
+ * или NULL если такой не был найден
+*/
+char *yon_config_get_parameter(config_str parameters, int size, char *param)
+{
+ if (param[0]==' ')
+ yon_char_divide_search(param," ",-1);
+ param=yon_char_divide_search(yon_char_new(param)," ",-1);
+
+ char *str = NULL;
+ for (int j = 0; j < size; j++)
+ {
+ char *name = yon_char_divide_search(yon_char_new(parameters[j]), "=", 1);
+ if (name)
+ {
+ if (strcmp(name, param) == 0)
+ {
+ str = yon_char_divide_search(yon_char_new(parameters[j]), "\n", 1);
+ if (strcmp(str, "") != 0 && strcmp(str, "(null)") != 0)
+ return str;
+ else
+ return NULL;
+ }
+ }
+ }
+ return NULL;
+}
+
+
+
+// terminal-using functions
+
+/**yon_launch_app_with_arguments(char *name, char *args)
+ * [EN]
+ * Execute [command] in separate thread;
+ * [RU]
+ * Выполнить команду [command] в отдельном потоке;
+*/
+int yon_launch_app_with_arguments(char *name, char *args)
+{
+ char *path = yon_char_unite("/usr/bin/", name, " ", args,NULL);
+ pthread_t thread_id;
+ char *command = NULL;
+ command = path;
+ pthread_create(&thread_id, NULL, (void *)yon_launch, command);
+};
+
+/**yon_launch(char *command)
+ * [EN]
+ * Execute command [command]
+ * [RU]
+ * Выполнить команду [command]
+*/
+void yon_launch(char *command)
+{
+ system(command);
+}
+
+// Gtk functions
+
+
+#ifdef __GTK_H__
+
+
+static render_data render;
+
+#ifdef VTE_TERMINAL
+
+static void child_ready(VteTerminal *terminal, GPid pid, GError *error, gpointer user_data)
+{
+ if (!terminal) return;
+ if (pid == -1) printf("Error\n\n\n");
+ else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data));
+}
+
+/**
+ * void yon_terminal_integrated_launch(GtkWidget *place_to_show, void *endwork_function, void* endwork_function_argument)
+ * [EN]
+ * launches terminal with specific [command],
+ * terminal is shown in [place_to_show] container,
+ * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument.
+ * [RU]
+ * Запускает терминал с командой [command],
+ * терминал добавляется в контейнер [place_to_show] виджета,
+ * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument].
+*/
+void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument){
+ char **commands=new_arr(char*,2);
+ gchar **envp = g_get_environ();
+ commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL"));
+ commands[1]=NULL;
+ char **env=new_arr(char*,2);
+ env[0]="";
+ env[1]=NULL;
+ GtkWidget *terminal = vte_terminal_new();
+ vte_terminal_set_size(VTE_TERMINAL(terminal),10,15);
+ VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL);
+ vte_terminal_set_pty(VTE_TERMINAL(terminal),pty);
+ gtk_container_add(GTK_CONTAINER(place_to_show),terminal);
+ char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL);
+ printf("%s\n",install_command);
+ if(endwork_function)
+ g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument);
+ vte_terminal_spawn_async(VTE_TERMINAL(terminal),
+ VTE_PTY_DEFAULT,
+ NULL,
+ commands,
+ NULL,
+ 0,
+ NULL, NULL,
+ NULL,
+ -1,
+ NULL,
+ child_ready,
+ install_command);
+ vte_pty_spawn_async(pty,
+ NULL,
+ commands,
+ NULL,
+ 0,
+ NULL, NULL,
+ NULL,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+ vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), -1);
+ vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE);
+ vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE);
+ gtk_widget_show_all(terminal);
+ }
+
+/**yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument)
+ * [EN]
+ * launches terminal with specific [command],
+ * terminal is shown in [place_to_show] container,
+ * after terminal done its work [endwork_function] is called with [endwork_function_argument] argument.
+ * [RU]
+ * Запускает терминал с командой [command],
+ * терминал добавляется в контейнер [place_to_show] виджета,
+ * после завершения работы терминала вызывается функция [endwork_function] с аргументом [endwork_function_argument].
+*/
+void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument){
+ char **commands=new_arr(char*,2);
+ gchar **envp = g_get_environ();
+ commands[0]=(gchar *)g_strdup(g_environ_getenv(envp, "SHELL"));
+ commands[1]=NULL;
+ char **env=new_arr(char*,2);
+ env[0]="";
+ env[1]=NULL;
+ vte_terminal_set_size(VTE_TERMINAL(terminal),10,15);
+ VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL);
+ vte_terminal_set_pty(VTE_TERMINAL(terminal),pty);
+ char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL);
+ if(endwork_function)
+ g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument);
+ vte_terminal_spawn_async(VTE_TERMINAL(terminal),
+ VTE_PTY_DEFAULT,
+ NULL,
+ commands,
+ NULL,
+ 0,
+ NULL, NULL,
+ NULL,
+ -1,
+ NULL,
+ child_ready,
+ install_command);
+ vte_pty_spawn_async(pty,
+ NULL,
+ commands,
+ NULL,
+ 0,
+ NULL, NULL,
+ NULL,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+ vte_terminal_set_scrollback_lines(VTE_TERMINAL(terminal), 100);
+ vte_terminal_set_scroll_on_output(VTE_TERMINAL(terminal), TRUE);
+ vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(terminal), TRUE);
+ gtk_widget_show_all(terminal);
+ }
+#endif
+ // Window config functions
+ #define check_window_config_setup if(__yon_window_config_target_window)
+ struct {
+ int x;
+ int y;
+ int width;
+ int height;
+ int fullscreen;
+ } __yon_main_window_config;
+ static GtkWindow *__yon_window_config_target_window = NULL;
+ static GKeyFile *__yon_window_config_file = NULL;
+ static char *__yon_window_config_path = NULL;
+
+ void yon_window_config_save(){
+ g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x);
+ g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y);
+ g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width);
+ g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height);
+ g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen);
+ g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL);
+ }
+
+ void yon_get_is_fullscreen(){
+ gtk_window_is_maximized(__yon_window_config_target_window);
+ __yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window);
+ }
+
+
+ void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){
+ check_window_config_setup{
+ yon_get_is_fullscreen();
+ yon_window_config_save();
+ }
+ gtk_main_quit();
+ }
+
+ void __yon_window_config_on_resize(){
+ int max=0;
+ max=gtk_window_is_maximized(__yon_window_config_target_window);
+ if(max==0){
+ printf("resized\n");
+ gtk_window_get_size(__yon_window_config_target_window,&__yon_main_window_config.width,&__yon_main_window_config.height);
+ gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y);
+ }
+ }
+
+ void yon_window_config_setup(GtkWindow *window){
+ __yon_window_config_target_window = window;
+ g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_configured_window_destroy),NULL);
+ g_signal_connect(G_OBJECT(window),"check-resize"/*"configure-event"*/,G_CALLBACK(__yon_window_config_on_resize),NULL);
+ }
+
+ void _yon_maximize(void *data){
+ g_usleep(G_USEC_PER_SEC/10);
+ if(__yon_main_window_config.fullscreen ==1) gtk_window_maximize(__yon_window_config_target_window);
+ }
+
+ int yon_window_config_load(char *path){
+ __yon_window_config_file = g_key_file_new();
+ __yon_window_config_path=yon_char_new(path);
+ if (!g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL)){
+ struct stat st;
+ int size;
+ config_str conf = yon_char_parse(yon_char_new(__yon_window_config_path),&size,"/");
+ char *path = yon_char_unite(conf[0],"/",conf[1],"/",conf[2],"/",conf[3],"/",conf[4],"/",NULL);
+ if (stat(path, &st) == -1) {
+ mkdir(path, 0777);
+ }
+ FILE *fp;
+ fp=fopen(__yon_window_config_path,"w");
+ fclose(fp);
+ g_key_file_load_from_file(__yon_window_config_file,__yon_window_config_path,G_KEY_FILE_NONE,NULL);
+ }
+ __yon_main_window_config.x = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosX",NULL);
+ __yon_main_window_config.y = g_key_file_get_integer(__yon_window_config_file,"window","WindowPosY",NULL);
+ __yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL);
+ __yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL);
+ __yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL);
+ if (__yon_main_window_config.width==0) __yon_main_window_config.width=800;
+ if (__yon_main_window_config.height==0) __yon_main_window_config.height=600;
+ gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
+ gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y);
+ pthread_t tid;
+ pthread_create(&tid,NULL,(void *)_yon_maximize,NULL);
+ return 1;
+ }
+
+ void yon_window_config_apply(){
+ dictionary *dict=NULL;
+ gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y);
+ gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height);
+ }
+
+int yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size){
+ if (combo&¶meters){
+ for (int i=0;imessage);
+ g_error_free(err);
+ }
+ if (type == BACKGROUND_IMAGE_SUCCESS_TYPE||! type)
+ {
+ gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessError");
+ gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK");
+ gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err));
+ }
+ else if (type == BACKGROUND_IMAGE_FAIL_TYPE)
+ {
+ gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK");
+ gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessError");
+ gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err));
+ }
+ if (text)
+ gtk_label_set_text(GTK_LABEL(data.label), text);
+}
+
+void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type){
+ _yon_ubl_status_box_render(text,type);
+}
+
+/**yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id)
+ * [EN]
+ * Set up plugs for using with GtkSockets insine ubl-settings-manager.
+ * [main_window] is container widget, which holds main application functionality.
+ * [left_window] is container widget, which holds widgets, have to be shown at left part of ubl-settings-manager header.
+ * [right_window] is container widget, which holds widgets, have to be shown at right part of ubl-settings-manager header.
+ * [socket_main_id] is id of socket for [main_window].
+ * [socket_left_id] is id of socket for [left_window].
+ * [socket_right_id] is id of socket for [right_window].
+ * [RU]
+ * Настраивает плаги для работы с сокетами в утилите ubl-settings-manager.
+ * [main_window] - контейнер основного интерфейса приложения.
+ * [left_window] - контейнер для виджетов которые должны отображаться в левой части шапки ubl-settings-manager.
+ * [right_window] - контейнер для виджетов которые должны отображаться в правой части шапки ubl-settings-manager.
+ * [socket_main_id] - id сокета для [main_window].
+ * [socket_left_id] - id сокета для [left_window].
+ * [socket_right_id] - id сокета для [right_window].
+*/
+void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id){
+ if (main_window&&socket_main_id>-1){
+ gtk_widget_hide(gtk_widget_get_toplevel(main_window));
+ GtkWidget *plug_main=gtk_plug_new(socket_main_id);
+ GtkWidget *plug_left=NULL;
+ GtkWidget *plug_right=NULL;
+ GtkWidget *box=NULL;
+ g_signal_connect(G_OBJECT(plug_main), "destroy", G_CALLBACK(gtk_main_quit),NULL);
+ if (socket_left_id>-1&&left_window){
+ plug_left=gtk_plug_new(socket_left_id);
+ g_object_ref(left_window);
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(left_window)),left_window);
+ gtk_container_add(GTK_CONTAINER(plug_left),left_window);
+ gtk_style_context_add_class(gtk_widget_get_style_context(plug_left),"primary-toolbar");
+ gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"button");
+ gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"opacited");
+ gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"color");
+ gtk_style_context_add_class(gtk_widget_get_style_context(plug_left),"noborder");
+ gtk_widget_show(plug_left);
+ }
+ else if (left_window){
+ if (box==NULL){
+ box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
+ gtk_box_pack_start(GTK_BOX(main_window),box,0,0,5);
+ gtk_box_reorder_child(GTK_BOX(main_window),box,0);
+ gtk_widget_show(box);
+ }
+ gtk_style_context_add_class(gtk_widget_get_style_context(left_window),"inherited");
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(left_window)),left_window);
+ gtk_box_pack_end(GTK_BOX(box),left_window,0,0,5);
+ }
+ if (socket_right_id>-1&&right_window){
+ plug_right=gtk_plug_new(socket_right_id);
+ g_object_ref(right_window);
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(right_window)),right_window);
+ gtk_container_add(GTK_CONTAINER(plug_right),right_window);
+ gtk_style_context_add_class(gtk_widget_get_style_context(plug_right),"primary-toolbar");
+ gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"button");
+ gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"opacited");
+ gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"color");
+ gtk_style_context_add_class(gtk_widget_get_style_context(plug_right),"noborder");
+ gtk_widget_show(plug_right);
+ }
+ else if (right_window){
+ if (box==NULL){
+ box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
+ gtk_box_pack_start(GTK_BOX(main_window),box,0,0,5);
+ gtk_box_reorder_child(GTK_BOX(main_window),box,0);
+ gtk_widget_show(box);
+ }
+ gtk_style_context_add_class(gtk_widget_get_style_context(right_window),"inherited");
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(right_window)),right_window);
+ gtk_box_pack_start(GTK_BOX(box),right_window,0,0,5);
+ }
+ g_object_ref(main_window);
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(main_window)),main_window);
+ gtk_container_add(GTK_CONTAINER(plug_main),main_window);
+ gtk_widget_show(plug_main);
+ }
+}
+
+#ifdef WEBKIT_FOUND
+
+/**yon_ubl_browser_window_open(char *link, char *browser_window_name)
+ * [EN]
+ * Launches integrated browser window, named [browser_window_name] at header with [link].
+ * [RU]
+ * Открывает встроенный браузер с именем [browser_window_name] и показываемой страницей по ссылке [link]
+*/
+void yon_ubl_browser_window_open(char *link, char *browser_window_name){
+ GtkWidget *browser=gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ GtkWidget *web_place=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
+ GtkWidget *header=gtk_header_bar_new();
+ GtkWidget *header_label=gtk_label_new(browser_window_name);
+ GtkWidget *WebView=webkit_web_view_new();
+ gtk_container_add(GTK_CONTAINER(browser),web_place);
+ gtk_window_set_titlebar(GTK_WINDOW(browser),header);
+ gtk_window_set_title(GTK_WINDOW(browser),browser_window_name);
+ gtk_widget_set_size_request(browser,800,600);
+ gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label);
+ gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(header),1);
+ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(WebView),link);
+ gtk_box_pack_start(GTK_BOX(web_place),WebView,1,1,0);
+ gtk_widget_show_all(browser);
+}
+#else
+
+/**yon_ubl_browser_window_open(char *link, char *browser_window_name)
+ * [EN]
+ * Launches browser with [link].
+ * [browser_window_name] is't used. It's needed for compatibility with webkit version of that function.
+ * [RU]
+ * Открывает браузер со страницей по ссылке [link]
+ * [browser_window_name] не используется. Нужна для совместимости с webkit версией этой функции.
+*/
+void yon_ubl_browser_window_open(char *link, char *browser_window_name){
+ char *user=getenv("SUDO_USER");
+ if (!user)
+ user=getlogin();
+ char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL);
+ yon_launch_app(command);
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/source/ubl-utils.h b/source/ubl-utils.h
new file mode 100644
index 0000000..8bc463d
--- /dev/null
+++ b/source/ubl-utils.h
@@ -0,0 +1,339 @@
+#ifndef UBL_UTILS
+#define UBL_UTILS
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ubl-cmake.h"
+#ifdef WEBKIT_FOUND
+ #include
+#endif
+#define DesktopPath "/usr/share/applications/"
+
+#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next)
+
+#define new(type) malloc(sizeof(type))
+#define new_arr(type,size) malloc(sizeof(type)*size)
+
+
+typedef enum
+{
+ #ifdef __GTK_H__
+ DICTIONARY_GTK_WIDGETS_TYPE,
+ #endif
+ DICTIONARY_OTHER_TYPE=0,
+ DICTIONARY_CHAR_TYPE,
+ DICTIONARY_INT_TYPE,
+ DICTIONARY_BOOL_TYPE,
+
+} DICT_TYPE;
+
+typedef struct dictionary
+{
+ char *key;
+ void *data;
+ struct dictionary *next;
+ struct dictionary *prev;
+ struct dictionary *first;
+ DICT_TYPE data_type;
+ int flag1;
+} dictionary;
+
+typedef struct apps
+{
+ char *Name;
+ int Type;
+ char *Categories;
+ char *Exec;
+ char *Icon;
+ int Pluggable;
+ int DualPluggable;
+} apps;
+
+typedef char** config_str;
+
+static dictionary *__yon__config__strings = NULL;
+#define check_config if(__yon__config__strings&&__yon__config__strings->data_type==DICTIONARY_CHAR_TYPE)
+
+#define config(key) yon_config_get_by_key(key)
+
+#define for_config dictionary temp = NULL; for_dictionary(temp,__yon__config__strings)
+
+#define yon_remalloc(pointer, size) (!pointer) ? malloc(size) : realloc(pointer, size)
+// dictionary functions
+
+/**yon_dictionary_get_data(dictionary, type)
+ * [EN]
+ * Gets data from dictionary.
+ * [dictionary] is dictionary, from which data should be extracted;
+ * [type] is type of data, [dictionary] contains.
+ * [RU]
+ * Возвращает данные из словаря.
+ * [dictionary] - словарь из которого достаются данные.
+ * [type] - тип данных, хранящихся в словаре [dictionary].
+*/
+#define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data)
+
+/**yon_dictionary_add_or_create_if_exists_with_data(dict,key,data)
+ * [EN]
+ *
+ * [RU]
+ * Добавляет элемент словаря в конец словаря [dict] c ключом [key] и данными [data].
+ * Если словарь не существует, создаёт его
+*/
+#define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_dictionary_new_with_data(key,data); \
+ else dict=yon_dictionary_append_with_data(dict,key,data);}
+
+dictionary *yon_dictionary_new();
+
+dictionary *yon_dictionary_append(dictionary *targetdict);
+
+dictionary *yon_dictionary_get_last(dictionary *dict);
+
+dictionary *yon_dictionary_swap(dictionary *dict, int aim);
+
+void yon_dictionary_make_first(dictionary *dict);
+
+void yon_dictionary_make_nth(dictionary *dict, int nth);
+
+dictionary *yon_dictionary_new_with_data(char *key, void *data);
+
+dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data);
+
+dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect);
+
+dictionary *yon_dictionary_get(dictionary **dict, char *key);
+
+dictionary *yon_dictionary_rip(dictionary *dict);
+
+dictionary *yon_dictionary_get_nth(dictionary *dict, int place);
+
+void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(void*));
+
+// char functions
+
+char *yon_char_append(char *source, char *append);
+
+char *yon_char_new(char *chr);
+
+char *yon_char_unite(char *source, ...);
+
+char *yon_cut(char *source, int size, int startpos);
+
+char *yon_char_divide(char *source, int dividepos);
+
+char *yon_char_divide_search(char *source, char *dividepos, int delete_divider);
+
+char *yon_char_from_int(int int_to_convert);
+
+char *yon_char_replace(char *source, char *find, char*replace);
+
+char **yon_char_parse(char *parameters, int *size, char *divider);
+
+char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete);
+
+int yon_char_parsed_check_exist(char **parameters, int size, char *param);
+
+int yon_char_find_count(char *source, char *find);
+
+int yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size);
+
+config_str yon_char_parsed_new (int *size, ...);
+
+void yon_char_parsed_copy(config_str *source, config_str *to_copy);
+
+config_str yon_char_parsed_append(config_str parsed, int *size, char *string);
+
+int yon_ubl_check_root();
+
+char *yon_ubl_root_user_get();
+
+// parsing functions
+
+config_str philos_list_user(int* size);
+
+apps *yon_apps_scan_and_parse_desktops(int *sizef);
+
+void yon_apps_sort(apps *applist, int size);
+
+apps *yon_apps_get_by_name(apps *applist, char *name, int size);
+
+config_str yon_config_load(char *command, int *str_len);
+
+int yon_config_save(char *command);
+
+char *yon_config_get_parameter(config_str parameters, int size, char *param);
+
+int yon_config_load_register(char *command);
+
+int yon_config_remove_by_key(char *key);
+
+int yon_config_remove_by_data(void *data);
+
+int yon_config_remove_element(char *key, char *deleted);
+
+void *yon_config_get_by_key(char *key);
+
+char *yon_config_get_key_by_data(char *data);
+
+int yon_config_set(char *key, void *data);
+
+int yon_config_clean();
+
+void yon_config_register(char *key, void *data);
+
+config_str yon_config_get_all();
+
+// terminal-using functions
+
+int yon_launch_app_with_arguments(char *name, char *args);
+
+void yon_launch(char *command);
+
+// Gtk functions
+
+#ifdef __GTK_H__
+#ifdef VTE_TERMINAL
+void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument);
+
+void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument);
+
+#endif
+
+/**yon_gtk_builder_get_widget(builder, widget_name)
+ * [EN]
+ * Returns GtkWidget from GtkBuilder *[builder].
+ * [builder] is GtkBuilder*;
+ * [widget_name] is id of widget;
+*/
+#define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name))
+
+typedef struct
+{
+ GtkWidget *Icon;
+ GtkWidget *Label;
+ GtkWidget *IconView;
+ GtkListStore *List;
+} expander_icon_view;
+
+void yon_window_config_setup(GtkWindow *window);
+
+int yon_window_config_load(char *path);
+
+int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size);
+
+int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find);
+
+int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment);
+
+int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...);
+
+int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...);
+
+
+
+typedef enum
+{
+ BACKGROUND_IMAGE_SUCCESS_TYPE,
+ BACKGROUND_IMAGE_FAIL_TYPE
+} BACKGROUND_IMAGE_TYPE;
+
+typedef struct {
+ BACKGROUND_IMAGE_TYPE type;
+ GtkWidget *icon;
+ GtkWidget *box;
+ GtkWidget *label;
+ char* text_to_render;
+} render_data;
+
+
+/**yon_ubl_status_box_setup(render,icon,box,label)
+ * [EN]
+ * Sets up [render] structure of type render_data.
+ * [icon] is GtkImage widget of status box for showing status icons;
+ * [box] is GtkBox widget of status box for showing status color;
+ * [label] is GtkLabel widget of status box for showing status text;
+ * [RU]
+ * Настраивает структуру [render] типа render_data.
+ * [icon] - виджет типа GtkIcon в котором будут отображаться статусные иконки;
+ * [box] - виджет типа GtkBox в котором будет отображаться цвет статуса;
+ * [label] - виджет типа GtkLabel в котором будет отображаться текст статусного сообщения;
+*/
+int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label);
+
+/**yon_ubl_status_box_render(render,text,type)
+ * [EN]
+ * Renders message in status box;
+ * [render] is render_data structure of status box;
+ * [text] is text to be shown in status box;
+ * [type] if type of message. Can be BACKGROUND_IMAGE_FAIL_TYPE or BACKGROUND_IMAGE_SUCCESS_TYPE
+ * [RU]
+ * Отображает сообщение в статусном окне.
+ * [render] - структура типа render_data для нужного статусного окна;
+ * [text] - текст, отображаемый в статусном окне;
+ * [type] - тип сообщения. Может быть:
+ * BACKGROUND_IMAGE_FAIL_TYPE (красный фон,иконка - восклицательный знак)
+ * или
+ * BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка)
+*/
+void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type);
+
+#ifdef __cplusplus
+
+/**yon_ubl_header_setup(overlay, head, image, imag_path)
+ * [EN]
+ * Sets up header of app.
+ * [overlay] is overlay for app header;
+ * [head] is box of header, which connects to [overlay]
+ * [image] is header background image;
+ * [imag_path] is path of image, shown in [image]
+ * [RU]
+ * Настраивает заголовок приложения.
+ * [overlay] - оверлей заголовка приложения;
+ * [head] - шапка заголовка, присоединяемая к [overlay]
+ * [image] - виджет картинки для заднего фона;
+ * [imag_path] - путь до картинки, загружаемой в [image]
+*/
+#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay.gobj()), GTK_WIDGET(head.gobj()), GTK_WIDGET(image.gobj()), (char *)imag_path)
+#else
+
+/**yon_ubl_header_setup(overlay, head, image, imag_path)
+ * [EN]
+ * Sets up header of app.
+ * [overlay] is overlay for app header;
+ * [head] is box of header, which connects to [overlay]
+ * [image] is header background image;
+ * [imag_path] is path of image, shown in [image]
+ * [RU]
+ * Настраивает заголовок приложения.
+ * [overlay] - оверлей заголовка приложения;
+ * [head] - шапка заголовка, присоединяемая к [overlay]
+ * [image] - виджет картинки для заднего фона;
+ * [imag_path] - путь до картинки, загружаемой в [image]
+*/
+#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path)
+#define yon_ubl_header_setup_resource(overlay, head, image, imag_path) _yon_ubl_header_setup_resource(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path)
+#endif
+
+void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path);
+
+void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path);
+
+void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id);
+#ifdef WEBKIT_FOUND
+
+void yon_ubl_browser_window_open(char *link, char *browser_window_name);
+#else
+void yon_ubl_browser_window_open(char *link, char *browser_window_name);
+#endif
+#endif
+#endif
\ No newline at end of file
diff --git a/ubl-settings-usergroups b/ubl-settings-usergroups
new file mode 100755
index 0000000..1e09c33
Binary files /dev/null and b/ubl-settings-usergroups differ
diff --git a/ubl-settings-usergroups-banner.png b/ubl-settings-usergroups-banner.png
new file mode 100644
index 0000000..8eb67cb
Binary files /dev/null and b/ubl-settings-usergroups-banner.png differ
diff --git a/ubl-settings-usergroups-group.glade b/ubl-settings-usergroups-group.glade
new file mode 100644
index 0000000..a9467bf
--- /dev/null
+++ b/ubl-settings-usergroups-group.glade
@@ -0,0 +1,292 @@
+
+
+
+
+
+
+
+
diff --git a/ubl-settings-usergroups-user.glade b/ubl-settings-usergroups-user.glade
new file mode 100644
index 0000000..97ce3c7
--- /dev/null
+++ b/ubl-settings-usergroups-user.glade
@@ -0,0 +1,412 @@
+
+
+
+
+
+ True
+ False
+ emblem-ok-symbolic
+
+
+ True
+ False
+ process-stop-symbolic
+
+
+ False
+ False
+ True
+ 450
+ com.ublinux.ubl-settings-usergroups
+
+
+ True
+ False
+ 5
+ 5
+ 5
+ 5
+ 5
+ 5
+ vertical
+ 10
+
+
+ True
+ False
+ vertical
+ 5
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ UID:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ User name:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 1
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ Login:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 2
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ Password:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ Default
+ True
+ True
+ False
+ True
+
+
+ False
+ True
+ 1
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 2
+
+
+
+
+ False
+ True
+ 3
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ Main group:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ Additional groups
+ True
+ True
+ True
+
+
+ False
+ True
+ 2
+
+
+
+
+ False
+ True
+ 4
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ Password hash algorythm:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+
+ - sha256
+ - AIX md5
+ - md5 (apache variant)
+ - md5
+
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 5
+
+
+
+
+ Sync with SAMBA user
+ True
+ True
+ False
+ True
+
+
+ False
+ True
+ 6
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ Extra options:
+ 0
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ True
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ 7
+
+
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ 30
+ True
+
+
+ Cancel
+ True
+ True
+ True
+ image7
+
+
+
+ True
+ True
+ 0
+
+
+
+
+ Save
+ True
+ True
+ True
+ image10
+
+
+
+ True
+ True
+ 1
+
+
+
+
+ False
+ True
+ end
+ 1
+
+
+
+
+
+
+
+
+
diff --git a/ubl-settings-usergroups.css b/ubl-settings-usergroups.css
index c5b88a3..8687d4a 100644
--- a/ubl-settings-usergroups.css
+++ b/ubl-settings-usergroups.css
@@ -1,143 +1,108 @@
-.bannerbackground {
-background-color: #404040;
-}
-.thin{
- padding:0px;
- margin:0px;
- transition: 0ms ease-out;
+.thin {
+ margin:0px;
+ padding:0px;
}
-.thin:active {
- background-color: @theme_selected_bg_color;
- transition: 10ms ease-out;
+.noborder {
+ border:none;
}
-.transparent {
- background:none;
- border:none;
- transition: 0ms ease-out;
+.nobackground {
+background:transparent;
}
-
-#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;
+.nobackground:active {
+background:transparent;
}
-
-#SepIcon{
- background-color: alpha(@theme_text_color, 0.6);
+.textHead{
+ text-shadow: 2px 2px @theme_bg_color;
+ color: @theme_text_color;
}
-#iconlabel {
- font-size:14px;
- font-weight: bold;
-
-}
-.roundborder > * {
- border-width:0px;
+.inherited>* {
+ border:none;
+ background:inherit;
}
-.roundborder:backdrop > * {
- border-width:0px;
- border-radius:5px;
-}
-.noborder {
- border: none;
+.workingbg {
+ background:@theme_base_color;
}
-
.menuitembottom{
- margin-top:0px;
- margin-bottom:3px;
- border-color:inherit;
- border-left-width:inherit;
- border-right-width:inherit;
-}
-.menuitemmiddle{
- margin-top:0px;
- margin-bottom:0px;
- border-color:inherit;
- border-left-width:inherit;
- border-right-width:inherit;
-}
-
-.menuitemtop{
- margin-bottom:0px;
- border-color:inherit;
- border-top-width:inherit;
- border-left-width:inherit;
- border-right-width:inherit;
-}
-.menuitemtop *{
- margin:2px 2px 0 2px;
- padding: 5px 10px 3px 5px;
- border:transparent;
-}
-.menuitemmiddle *{
- margin:0 2px 0 2px;
- padding: 3px 10px 3px 5px;
- border:transparent;
-}
-.menuitembottom *{
- margin:0 2px 2px 2px;
- padding: 3px 10px 5px 5px;
-}
-.menuitemtop:hover {
- background:@theme_bg_color;
- border-color:inherit;
- border-top-width:inherit;
- border-left-width:inherit;
- border-right-width:inherit;
-}
-.menuitemmiddle:hover {
- background:@theme_bg_color;
- border-color:inherit;
- border-left-width:inherit;
- border-right-width:inherit;
-}
-.menuitembottom:hover {
- background:@theme_bg_color;
- border-color:inherit;
- border-bottom-width:0px;
- border-left-width:inherit;
- border-right-width:inherit;
+ margin-top:0px;
+ margin-bottom:3px;
+ border-color:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemmiddle{
+ margin-top:0px;
+ margin-bottom:0px;
+ border-color:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemtop{
+ margin-bottom:0px;
+ border-color:inherit;
+ border-top-width:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemtop *{
+ margin:2px 2px 0 2px;
+ padding: 5px 10px 3px 5px;
+ border:transparent;
+ }
+ .menuitemmiddle *{
+ margin:0 2px 0 2px;
+ padding: 3px 10px 3px 5px;
+ border:transparent;
+ }
+ .menuitembottom *{
+ margin:0 2px 2px 2px;
+ padding: 3px 10px 5px 5px;
+ }
+ .menuitemtop:hover {
+ background:@theme_bg_color;
+ border-color:inherit;
+ border-top-width:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitemmiddle:hover {
+ background:@theme_bg_color;
+ border-color:inherit;
+ border-left-width:inherit;
+ border-right-width:inherit;
+ }
+ .menuitembottom:hover {
+ background:@theme_bg_color;
+ border-color:inherit;
+ border-bottom-width:0px;
+ border-left-width:inherit;
+ border-right-width:inherit;
+
+ }
+ .menuitemtop:hover* {
+ margin:2px 2px 0 2px;
+ padding: 5px 10px 3px 5px;
+ background:@theme_selected_bg_color;
+ border-radius:2px;
+ }
+ .menuitemmiddle:hover* {
+ margin:0 2px 0 2px;
+ padding: 3px 10px 3px 5px;
+ background:@theme_selected_bg_color;
+ border-radius:2px;
+ }
+ .menuitembottom:hover* {
+ margin:0 2px 2px 2px;
+ padding: 3px 10px 5px 5px;
+ background:@theme_selected_bg_color;
+ border-radius:2px;
+ }
+ .boxInfoMessError{
+ background-color: #ea9999;
}
-.menuitemtop:hover* {
- margin:2px 2px 0 2px;
- padding: 5px 10px 3px 5px;
- background:@theme_selected_bg_color;
- border-radius:2px;
-}
-.menuitemmiddle:hover* {
- margin:0 2px 0 2px;
- padding: 3px 10px 3px 5px;
- background:@theme_selected_bg_color;
- border-radius:2px;
-}
-.menuitembottom:hover* {
- margin:0 2px 2px 2px;
- padding: 3px 10px 5px 5px;
- background:@theme_selected_bg_color;
- border-radius:2px;
-}
-
-.workingbg, #workingbg {
- background-color:@theme_base_color;
-}
-
-.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;
-}
-
-
+.boxInfoMessOK{
+ background-color: #f3f0ac;
+}
\ No newline at end of file
diff --git a/ubl-settings-usergroups.desktop b/ubl-settings-usergroups.desktop
index 2933781..e192dfd 100644
--- a/ubl-settings-usergroups.desktop
+++ b/ubl-settings-usergroups.desktop
@@ -1,15 +1,15 @@
[Desktop Entry]
Encoding=UTF-8
-Name=ubl-settings-usergroups
-Name[ru]=Настройки пользователей и групп
+Name=Users and groups
+Name[ru]=Пользователи и группы
GenericName=ubl-settings-usergroups
-GenericName[ru]=Настройки пользователей и групп
-Comment=ubl-settings-usergroups
-Comment[ru]=Приложение для управления настройками пользователей и групп
+GenericName[ru]=Пользователи и группы
+Comment=System users and groups configuration
+Comment[ru]=Настройка пользователей и групп системы (глобальная настройка, через конфигурационный файл)
Type=Application
-Exec=ubl-settings-usergroups
+Exec=pkexec ubl-settings-usergroups
Icon=com.ublinux.ubl-settings-usergroups
Terminal=false
X-XfcePluggable=true
X-UBLPluggable=true
-Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;
+Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;X-UBL-SettingsManager;X-UBL-Personal-Settings;
diff --git a/ubl-settings-usergroups.glade b/ubl-settings-usergroups.glade
index 68e963c..eced9ce 100644
--- a/ubl-settings-usergroups.glade
+++ b/ubl-settings-usergroups.glade
@@ -1,15 +1,32 @@
-
-
+
+
-
- True
- False
- label
-
-
+
+
+
+
+
False
- О Программе
False
True
center
@@ -17,10 +34,10 @@
dialog
True
ubl-settings-usergroups
- 1.0
- Copyright © 2023 - UBSoft Software LLC
- Settings for users and groups
- https://ublinux.ru/
+ 1.1
+ Copyright © 2022 - 2023, UBSoft LLC
+ Users and groups
+ https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-usergroups
Project Home Page
Это приложение распространяется без каких-либо гарантий.
Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>.
@@ -31,41 +48,67 @@
gpl-2-0
+ True
False
vertical
2
-
- False
+
False
- top
- spread
+ end
False
False
- 0
+ 1
-
-
+
+
+
+
-
+
+
+
+
+
+
+
True
@@ -139,43 +198,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
True
False
- user-trash-symbolic
-
+ value-increase-symbolic
True
False
- system-run-symbolic
+ document-edit-symbolic
True
False
- list-add-symbolic
+ user-trash-symbolic
True
False
- system-run-symbolic
+ document-edit-symbolic
-
+
True
False
- emblem-ok-symbolic
+ process-stop-symbolic
-
+
True
False
- process-stop-symbolic
+ emblem-ok-symbolic
-
+
False
- True
- com.ublinux.ubl-settings-usergroups
+ False
+ 450
+ dialog-question-symbolic
True
@@ -185,18 +254,20 @@
5
5
vertical
- 5
+ 10
True
False
- 5
-
+
True
False
- UID
- 0
+ start
+ 20
+ 20
+ dialog-question-symbolic
+ 6
False
@@ -204,219 +275,27 @@
0
-
-
- True
- True
- 1000
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- 5
-
-
- True
- False
- Username
- 0
-
-
- False
- True
- 0
-
-
-
-
- True
- True
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 1
-
-
-
-
- True
- False
- 5
-
-
- True
- False
- Login
- 0
-
-
- False
- True
- 0
-
-
-
-
- True
- True
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 2
-
-
-
-
- True
- False
- 5
-
-
- True
- False
- Password
- 0
-
-
- False
- True
- 0
-
-
-
-
- True
- True
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 3
-
-
-
-
- Default password
- True
- True
- False
- True
-
-
- False
- True
- 4
-
-
-
-
- True
- False
- 5
-
-
- True
- False
- Password hash algorythm
- 0
-
-
- False
- True
- 0
-
-
-
-
- True
- False
-
-
- True
- True
- 1
-
-
-
-
- False
- True
- 5
-
-
-
-
- Sync with SAMBA user
- True
- True
- False
- True
-
-
- False
- True
- 6
-
-
-
-
- True
- False
-
-
-
True
False
- 5
- 5
- 5
- True
+ vertical
-
- Cancel
+
False
@@ -425,12 +304,20 @@
-
- Add
+
True
- True
- True
- image5
+ False
+ start
+ start
+ 10
+ 10
+ You will be redirected to documentation website where documentation is
+translated and supported by community.
+ True
+ 0
+
False
@@ -438,95 +325,41 @@
1
+
+
+ Always redirect to online documentation
+ True
+ True
+ False
+ end
+ True
+
+
+
+ False
+ True
+ end
+ 2
+
+
+
- False
+ True
True
- end
1
+
- False
- True
- end
- 7
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- False
- True
- com.ublinux.ubl-settings-usergroups
-
-
- True
- False
- vertical
-
-
- True
- True
- liststore2
-
-
-
-
-
- Enabled
-
-
-
- 1
-
-
-
-
-
-
- Group
-
-
-
- 0
-
-
-
-
-
-
- False
+ True
True
0
@@ -535,34 +368,38 @@
True
False
- 5
- 5
- 5
- 5
- 5
+ 30
True
-
- button
+
+ Cancel
True
True
True
+ image8
+
- False
+ True
True
0
-
- button
+
+ Open documentation
True
True
True
+ image9
+
- False
+ True
True
1
@@ -571,91 +408,128 @@
False
True
- end
1
+
+
+
+
-
+ 800
+ 600
False
800
600
com.ublinux.ubl-settings-usergroups
-
+
True
False
- True
vertical
@@ -674,8 +548,8 @@
5
5
5
- 6
- 6
+ 5
+ 5
25
@@ -695,13 +569,14 @@
5
6
6
+ True
-
+
- True
+ False
True
1
@@ -714,17 +589,17 @@
-
+
True
False
vertical
-
+
81
True
False
-
+
True
False
start
@@ -751,27 +626,33 @@
True
False
+ 5
+ 5
5
5
5
5
+ True
+ True
vertical
5
True
False
+ vertical
+ 5
-
+
True
False
- vertical
5
-
+
True
False
- User groups (default)
+ 5
+ Default user groups:
0
@@ -781,24 +662,22 @@
-
+
True
- False
- User name
- 0
+ True
- False
+ True
True
1
-
+
True
- False
- User password
- 0
+ True
+ True
+ image4
False
@@ -806,103 +685,76 @@
2
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ 5
-
- True
- False
- Password hash algorythm:
- 0
-
-
- False
- True
- 3
-
-
-
-
- True
- False
- Autologin
- 0
-
-
- False
- True
- 4
-
-
-
-
+
True
False
- Update HOME directory(ies)
+ 5
+ Default user name (if there's no another):
0
False
True
- 5
+ 0
-
+
True
- False
- Automatically load user programs
- 0
+ True
- False
+ True
True
- 6
+ 1
- True
+ False
True
- 0
+ 1
+
+
+
+
+ User with ID 1000 is administrator
+ True
+ True
+ False
+ True
+
+
+ False
+ True
+ 2
True
False
- vertical
5
-
+
True
False
- 5
-
-
- True
- True
-
-
- True
- True
- 0
-
-
-
-
- True
- True
- True
- image4
-
-
-
- False
- True
- 1
-
-
+ 5
+ Default user password:
+ 0
False
@@ -911,35 +763,13 @@
-
+
True
- False
- 5
-
-
- Administrator
- True
- True
- False
- True
-
-
- False
- True
- 0
-
-
-
-
- True
- True
-
-
- True
- True
- 1
-
-
+ True
+ 30
+ False
+ ●
+ password
False
@@ -948,94 +778,54 @@
-
+
True
True
+ end
+ 30
+ False
+ ●
+ password
- True
+ False
True
+ end
2
-
- True
- False
-
-
- True
- True
- 3
-
-
-
-
+
True
False
-
-
- True
- True
- 4
-
-
-
-
- Enabled
- True
- True
- False
- 0
- True
+ Root user password:
False
True
- 5
-
-
-
-
- True
- True
-
-
- True
- True
- 6
+ end
+ 3
- True
+ False
True
- 1
+ 3
-
-
- False
- True
- 0
-
-
-
-
- True
- False
- vertical
- 5
True
False
5
-
+
True
False
- User string:
+ 5
+ Password hash algorythm:
+ 0
False
@@ -1044,9 +834,15 @@
-
+
True
- True
+ False
+
+ - sha256
+ - AIX md5
+ - md5 (apache variant)
+ - md5
+
True
@@ -1058,103 +854,107 @@
False
True
- 0
+ 4
+
+
+ False
+ True
+ 0
+
+
+
+
+ True
+ False
+ 5
-
+
True
- False
- 5
+ True
+ external
+ in
True
True
- liststore1
+ UserList
UID
+
+
+
Login
+
+
+
Password
+
+
+
- User Name
+ User name
+
+
+
+
+
+
+ True
+ True
+ 0
+
+
+
+
+ True
+ False
+ vertical
+ 5
+
+
+ True
+ True
+ True
+ image1
+
+
- True
+ False
True
0
-
+
True
- False
- vertical
- 5
-
-
- True
- True
- True
- image3
-
-
-
- False
- True
- 0
-
-
-
-
- True
- True
- True
- image2
-
-
-
- False
- True
- 1
-
-
-
-
- True
- True
- True
- image1
-
-
-
- False
- True
- 2
-
-
+ True
+ True
+ image2
+
False
@@ -1162,6 +962,22 @@
1
+
+
+ True
+ True
+ True
+ image3
+
+
+
+ False
+ True
+ 2
+
+
False
@@ -1171,14 +987,14 @@
- False
+ True
True
1
- True
+ False
True
2
@@ -1198,15 +1014,14 @@
False
True
-
+
-
+
diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot
new file mode 100644
index 0000000..559f905
--- /dev/null
+++ b/ubl-settings-usergroups.pot
@@ -0,0 +1,250 @@
+# Language translations for ubl-settings-usergroups package.
+# Copyright (C) 2022, UBTech LLC
+# This file is distributed under the same license as the ubl-settings-usergroups package.
+# UBLinux Team , 2022
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: ubl-settings-usergroups 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2023-05-22 16:12+0600\n"
+"PO-Revision-Date: \n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: source/ubl-strings.h:1
+msgid "Version:"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "ubl-settings-usergroups version:"
+msgstr ""
+
+#: source/ubl-strings.h:2 source/ubl-strings.h:4
+msgid "Users and groups"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Usage:"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "[OPTIONS]"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Options:"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Show this help"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Show package version"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Lock this help menu"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Lock configuration saving"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Lock local configration saving"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Lock global configration saving"
+msgstr ""
+
+#: source/ubl-strings.h:2
+msgid "Lock global configration loading"
+msgstr ""
+
+#: source/ubl-strings.h:5
+msgid "System users and groups configuration"
+msgstr ""
+
+#: source/ubl-strings.h:7
+msgid "Operation succeeded"
+msgstr ""
+
+#: source/ubl-strings.h:8
+msgid ""
+"Warning! Application was launched without root - root-dependent actions are "
+"locked"
+msgstr ""
+
+#: source/ubl-strings.h:10
+msgid "About"
+msgstr ""
+
+#: source/ubl-strings.h:11
+msgid "Documentation"
+msgstr ""
+
+#: source/ubl-strings.h:13
+msgid "Save to local configuration"
+msgstr ""
+
+#: source/ubl-strings.h:14
+msgid "Save to global configuration"
+msgstr ""
+
+#: source/ubl-strings.h:15
+msgid "Save configuration"
+msgstr ""
+
+#: source/ubl-strings.h:16
+msgid "Save"
+msgstr ""
+
+#: source/ubl-strings.h:18
+msgid "Load local configuration"
+msgstr ""
+
+#: source/ubl-strings.h:19
+msgid "Load global configuration"
+msgstr ""
+
+#: source/ubl-strings.h:20
+msgid "Load"
+msgstr ""
+
+#: source/ubl-strings.h:22
+msgid "Cancel"
+msgstr ""
+
+#: source/ubl-strings.h:24
+msgid "Would you like to read documentation in the Web?"
+msgstr ""
+
+#: source/ubl-strings.h:25
+msgid ""
+"You will be redirected to documentation website where documentation is\n"
+"translated and supported by community."
+msgstr ""
+
+#: source/ubl-strings.h:26
+msgid "Always redirect to online documentation"
+msgstr ""
+
+#: source/ubl-strings.h:27
+msgid "Open documentation"
+msgstr ""
+
+#: source/ubl-strings.h:28
+msgid "Project Home Page"
+msgstr ""
+
+#: source/ubl-strings.h:29
+msgid "Nothing were chosen"
+msgstr ""
+
+#: source/ubl-strings.h:32
+msgid "Global configuration loading succseeded."
+msgstr ""
+
+#: source/ubl-strings.h:33
+msgid "Local configuration loading succseeded."
+msgstr ""
+
+#: source/ubl-strings.h:34
+msgid "Config loading failed"
+msgstr ""
+
+#: source/ubl-strings.h:36
+msgid "Local and global configuration saving succseeded."
+msgstr ""
+
+#: source/ubl-strings.h:37
+msgid "Global configuration saving succseeded."
+msgstr ""
+
+#: source/ubl-strings.h:38
+msgid "Local configuration saving succseeded."
+msgstr ""
+
+#: source/ubl-strings.h:40
+msgid "Default user groups:"
+msgstr ""
+
+#: source/ubl-strings.h:41
+msgid "Default user name (if there's no another):"
+msgstr ""
+
+#: source/ubl-strings.h:42
+msgid "User with ID 1000 is administrator"
+msgstr ""
+
+#: source/ubl-strings.h:43
+msgid "Default user password:"
+msgstr ""
+
+#: source/ubl-strings.h:44
+msgid "Root user password:"
+msgstr ""
+
+#: source/ubl-strings.h:45 source/ubl-strings.h:59
+msgid "Password hash algorythm:"
+msgstr ""
+
+#: source/ubl-strings.h:47
+msgid "UID"
+msgstr ""
+
+#: source/ubl-strings.h:48
+msgid "Login"
+msgstr ""
+
+#: source/ubl-strings.h:49
+msgid "Password"
+msgstr ""
+
+#: source/ubl-strings.h:50
+msgid "User name"
+msgstr ""
+
+#: source/ubl-strings.h:52
+msgid "UID:"
+msgstr ""
+
+#: source/ubl-strings.h:53
+msgid "User name:"
+msgstr ""
+
+#: source/ubl-strings.h:54
+msgid "Login:"
+msgstr ""
+
+#: source/ubl-strings.h:55
+msgid "Password:"
+msgstr ""
+
+#: source/ubl-strings.h:56
+msgid "Default"
+msgstr ""
+
+#: source/ubl-strings.h:57
+msgid "Main group:"
+msgstr ""
+
+#: source/ubl-strings.h:58
+msgid "Additional groups"
+msgstr ""
+
+#: source/ubl-strings.h:60
+msgid "Sync with SAMBA user"
+msgstr ""
+
+#: source/ubl-strings.h:61
+msgid "Extra options:"
+msgstr ""
diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po
new file mode 100644
index 0000000..609c4ff
--- /dev/null
+++ b/ubl-settings-usergroups_ru.po
@@ -0,0 +1,257 @@
+# Russian translations for ubl-ubl-settings-usergroups package.
+# Copyright (C) 2022, UBTech LLC
+# This file is distributed under the same license as the ubl-ubl-settings-usergroups package.
+# UBLinux Team , 2022
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: ubl-ubl-settings-usergroups 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2023-05-22 16:12+0600\n"
+"PO-Revision-Date: 2023-01-01 00:00+0600\n"
+"Last-Translator: UBLinux Team \n"
+"Language-Team: Russian - UBLinux Team \n"
+"Language: Russian\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: source/ubl-strings.h:1
+msgid "Version:"
+msgstr "Версия:"
+
+#: source/ubl-strings.h:2
+#, fuzzy
+msgid "ubl-settings-usergroups version:"
+msgstr "Версия ubl-ubl-settings-usergroups: "
+
+#: source/ubl-strings.h:2 source/ubl-strings.h:4
+msgid "Users and groups"
+msgstr "Пользователи и группы"
+
+#: source/ubl-strings.h:2
+msgid "Usage:"
+msgstr "Использование:"
+
+#: source/ubl-strings.h:2
+msgid "[OPTIONS]"
+msgstr "[АРГУМЕНТЫ]"
+
+#: source/ubl-strings.h:2
+msgid "Options:"
+msgstr "Аргументы:"
+
+#: source/ubl-strings.h:2
+msgid "Show this help"
+msgstr "Показать параметры справки"
+
+#: source/ubl-strings.h:2
+msgid "Show package version"
+msgstr "Показать текущую версию"
+
+#: source/ubl-strings.h:2
+msgid "Lock this help menu"
+msgstr "Блокировка вызова справки"
+
+#: source/ubl-strings.h:2
+msgid "Lock configuration saving"
+msgstr "Блокировка сохранения локальной и глобальной конфигурации"
+
+#: source/ubl-strings.h:2
+msgid "Lock local configration saving"
+msgstr "Блокировка сохранения локальной конфигурации"
+
+#: source/ubl-strings.h:2
+msgid "Lock global configration saving"
+msgstr "Блокировка сохранения глобальной конфигурации"
+
+#: source/ubl-strings.h:2
+msgid "Lock global configration loading"
+msgstr "Блокировка загрузки глобальной конфигурации"
+
+#: source/ubl-strings.h:5
+msgid "System users and groups configuration"
+msgstr ""
+"Настройка пользователей и групп системы (глобальная настройка, через "
+"конфигурационный файл)"
+
+#: source/ubl-strings.h:7
+msgid "Operation succeeded"
+msgstr "Операция завершена"
+
+#: source/ubl-strings.h:8
+msgid ""
+"Warning! Application was launched without root - root-dependent actions are "
+"locked"
+msgstr ""
+"Внимание! Приложение было запущено без прав суперпользователя - действия, "
+"требующие их наличия заблокированы"
+
+#: source/ubl-strings.h:10
+msgid "About"
+msgstr "О программе"
+
+#: source/ubl-strings.h:11
+msgid "Documentation"
+msgstr "Справка"
+
+#: source/ubl-strings.h:13
+msgid "Save to local configuration"
+msgstr "Сохранить в локальную конфигурацию"
+
+#: source/ubl-strings.h:14
+msgid "Save to global configuration"
+msgstr "Сохранить в глобальную конфигурацию"
+
+#: source/ubl-strings.h:15
+msgid "Save configuration"
+msgstr "Сохранить конфигурацию"
+
+#: source/ubl-strings.h:16
+msgid "Save"
+msgstr "Сохранить"
+
+#: source/ubl-strings.h:18
+msgid "Load local configuration"
+msgstr "Загрузить локальную конфигуруцию"
+
+#: source/ubl-strings.h:19
+msgid "Load global configuration"
+msgstr "Загрузить глобальную конфигурацию"
+
+#: source/ubl-strings.h:20
+msgid "Load"
+msgstr "Загрузить"
+
+#: source/ubl-strings.h:22
+msgid "Cancel"
+msgstr "Отмена"
+
+#: source/ubl-strings.h:24
+msgid "Would you like to read documentation in the Web?"
+msgstr "Вы хотите прочитать справку в Сети?"
+
+#: source/ubl-strings.h:25
+msgid ""
+"You will be redirected to documentation website where documentation is\n"
+"translated and supported by community."
+msgstr ""
+"Вы будете перенаправлены на сайт с документацией где страницы помощи\n"
+"переводятся и поддерживаются сообществом."
+
+#: source/ubl-strings.h:26
+msgid "Always redirect to online documentation"
+msgstr "Всегда перенаправлять"
+
+#: source/ubl-strings.h:27
+msgid "Open documentation"
+msgstr "Прочитать справку"
+
+#: source/ubl-strings.h:28
+msgid "Project Home Page"
+msgstr "Домашняя страница проекта"
+
+#: source/ubl-strings.h:29
+msgid "Nothing were chosen"
+msgstr "Ничего не было выбрано"
+
+#: source/ubl-strings.h:32
+msgid "Global configuration loading succseeded."
+msgstr "Успешно загружена глобальная конфигурация"
+
+#: source/ubl-strings.h:33
+msgid "Local configuration loading succseeded."
+msgstr "Успешно загружена локальная конфигурация"
+
+#: source/ubl-strings.h:34
+msgid "Config loading failed"
+msgstr "Ошибка загрузки конфигурации"
+
+#: source/ubl-strings.h:36
+msgid "Local and global configuration saving succseeded."
+msgstr "Успешно записаны локальная и глобальная конфигурация"
+
+#: source/ubl-strings.h:37
+msgid "Global configuration saving succseeded."
+msgstr "Успешно записана глобальная конфигурация"
+
+#: source/ubl-strings.h:38
+msgid "Local configuration saving succseeded."
+msgstr "Успешно записана локальная конфигурация"
+
+#: source/ubl-strings.h:40
+msgid "Default user groups:"
+msgstr "Группы пользователей по умлочанию:"
+
+#: source/ubl-strings.h:41
+msgid "Default user name (if there's no another):"
+msgstr "Имя пользователя по умолчанию (если нет других):"
+
+#: source/ubl-strings.h:42
+msgid "User with ID 1000 is administrator"
+msgstr "Пользователь с ID 1000 является администратором"
+
+#: source/ubl-strings.h:43
+msgid "Default user password:"
+msgstr "Пароль для пользователя по умолчанию"
+
+#: source/ubl-strings.h:44
+msgid "Root user password:"
+msgstr "Пароль пользователя root"
+
+#: source/ubl-strings.h:45 source/ubl-strings.h:59
+msgid "Password hash algorythm:"
+msgstr "Алгоритм хэширования пароля"
+
+#: source/ubl-strings.h:47
+msgid "UID"
+msgstr "UID"
+
+#: source/ubl-strings.h:48
+msgid "Login"
+msgstr "Логин"
+
+#: source/ubl-strings.h:49
+msgid "Password"
+msgstr "Пароль"
+
+#: source/ubl-strings.h:50
+msgid "User name"
+msgstr "Имя пользователя"
+
+#: source/ubl-strings.h:52
+msgid "UID:"
+msgstr "UID:"
+
+#: source/ubl-strings.h:53
+msgid "User name:"
+msgstr "Имя пользователя:"
+
+#: source/ubl-strings.h:54
+msgid "Login:"
+msgstr "Логин:"
+
+#: source/ubl-strings.h:55
+msgid "Password:"
+msgstr "Пароль:"
+
+#: source/ubl-strings.h:56
+msgid "Default"
+msgstr "По умолчанию"
+
+#: source/ubl-strings.h:57
+msgid "Main group:"
+msgstr "Основная группа:"
+
+#: source/ubl-strings.h:58
+msgid "Additional groups"
+msgstr "Дополнительные группы"
+
+#: source/ubl-strings.h:60
+msgid "Sync with SAMBA user"
+msgstr "Синхронизировать с пользователем SAMBA"
+
+#: source/ubl-strings.h:61
+msgid "Extra options:"
+msgstr "Дополнительный опции:"