diff --git a/.gitignore b/.gitignore index 3a308bb..90cb1f3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ compile/ *# terminal-commands/ source/ubl-cmake.h -vgcore* \ No newline at end of file +vgcore* +.install.sh +ubl-settings-generator \ No newline at end of file diff --git a/Makefile b/Makefile index ecee835..435c5d1 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,11 @@ MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) CMAKE_COMMAND = cmake CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile -DEPENDS = /usr/bin/cmake +DEPENDS = /bin/cmake PREFIX ?= /usr/local PKGNAME = $(MAKEFILE_DIR) FILE_VER = source/${PKGNAME}.h -PKGIDENT = $(subst /,-,$(subst /usr,,${PREFIX})) +PKGIDENT=$(subst /,-,${PREFIX}) default_target: all @@ -24,6 +24,11 @@ init: @echo "Initialize ..."; \ if [ -d ".git" ]; then \ LATEST_TAG=$$(git describe --abbrev=0 --tags | sed 's/^v//'); \ + if [ -z "$${LATEST_TAG}" ]; \ + then \ + LATEST_TAG=$$"0.0"; \ + echo "$${LATEST_TAG} is empty"; \ + fi; \ else \ LATEST_TAG="Development"; \ fi; \ @@ -75,7 +80,7 @@ uninstall: @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ $(RM) "$${PATH_FILE_MO}"; \ done @for SIZE in 16x16 32x32 48x48 scalable; do \ @@ -102,9 +107,9 @@ install: check uninstall @echo "Install ..." @for FILE_PO in $(wildcard *.po); do \ LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ - install -dm755 "${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES"; \ + install -dm755 "${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES"; \ FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ - PATH_FILE_MO="${DESTDIR}${PREFIX}/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + PATH_FILE_MO="${DESTDIR}/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ echo "$${FILE_PO}"; \ msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \ done @@ -113,16 +118,32 @@ install: check uninstall rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \ done @install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg" - @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" + @cp ./com.ublinux.${PKGNAME}.policy ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy + @sed -e 's+/usr/bin+${PREFIX}/bin+' -e 's+.run+${PKGIDENT}.run+g' ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy -i @install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}" @install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop" - @install -Dm644 "com.ublinux.${PKGNAME}.policy" "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy" - @sed -e '\|annotate key=|s|/usr/bin|${PREFIX}/bin|' -e '/action id=/s/\.run/${PKGIDENT}\.run/' -i ${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.checked.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.warning.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.increase-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.profile-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.settings-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.sync-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.trash-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.view-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.edit-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.group-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.zoom-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.calendar-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.key-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.funnel-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.accept-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.cancel-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "icons/com.ublinux.${PKGNAME}.profile-settings-symbolic.svg" + @install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "${CMAKE_BUILD_DIR}/com.ublinux.${PKGNAME}${PKGIDENT}.policy" @if [ -z ${DESTDIR} ]; then \ - [ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \ + [ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/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; \ + [ -d "${DESTDIR}$/usr/share/applications" ] && touch "${DESTDIR}/usr/share/applications" &>/dev/null || true; \ fi @echo "Install: OK" @@ -141,7 +162,7 @@ help: echo "... init"; \ echo "... debug"; \ echo "... prepare"; \ - echo "... build"; \ + echo "... compile"; \ echo "... install"; \ echo "... uninstall"; \ echo "... clean" \ No newline at end of file diff --git a/README.md b/README.md index 006bbe3..5a8ac35 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ In order to build ubl-ubl-settings-usergroups you will need: - CMake - C compiler - GTK+ 3 & dependencies -- webkit2gtk (optional) +- webkit2gtk +- [libublsettings-ui](https://gitea.ublinux.ru/Applications/libublsettings-ui) Once you have all the necessary dependencies, you can use: ```sh diff --git a/VERSION.md b/VERSION.md deleted file mode 100644 index 48eea8c..0000000 --- a/VERSION.md +++ /dev/null @@ -1 +0,0 @@ -VERSION 1.3 diff --git a/gresource.xml b/gresource.xml index 09b2fec..081a63f 100644 --- a/gresource.xml +++ b/gresource.xml @@ -2,8 +2,12 @@ ubl-settings-usergroups.glade + ubl-settings-usergroups-group-creation.glade + ubl-settings-usergroups-additional-settings.glade + ubl-settings-usergroups-password.glade ubl-settings-usergroups-group.glade ubl-settings-usergroups-user.glade + ubl-settings-usergroups-system.glade ubl-settings-usergroups.css diff --git a/icons/com.ublinux.ubl-settings-usergroups.accept-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.accept-symbolic.svg new file mode 100644 index 0000000..79e0fdc --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.accept-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.calendar-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.calendar-symbolic.svg new file mode 100644 index 0000000..78715dc --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.calendar-symbolic.svg @@ -0,0 +1,47 @@ + + + + + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.cancel-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.cancel-symbolic.svg new file mode 100644 index 0000000..c045b0b --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.cancel-symbolic.svg @@ -0,0 +1,50 @@ + + + + + + + + + + diff --git a/com.ublinux.ubl-settings-usergroups.checked.svg b/icons/com.ublinux.ubl-settings-usergroups.checked.svg similarity index 100% rename from com.ublinux.ubl-settings-usergroups.checked.svg rename to icons/com.ublinux.ubl-settings-usergroups.checked.svg diff --git a/icons/com.ublinux.ubl-settings-usergroups.decrease-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.decrease-symbolic.svg new file mode 100644 index 0000000..1413e10 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.decrease-symbolic.svg @@ -0,0 +1,40 @@ + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.edit-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.edit-symbolic.svg new file mode 100644 index 0000000..baba3f9 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.edit-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.funnel-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.funnel-symbolic.svg new file mode 100644 index 0000000..4aec04a --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.funnel-symbolic.svg @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.group-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.group-symbolic.svg new file mode 100644 index 0000000..7cd4139 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.group-symbolic.svg @@ -0,0 +1,47 @@ + + + + + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.increase-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.increase-symbolic.svg new file mode 100644 index 0000000..800b264 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.increase-symbolic.svg @@ -0,0 +1,40 @@ + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.key-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.key-symbolic.svg new file mode 100644 index 0000000..a11cbf1 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.key-symbolic.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.profile-settings-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.profile-settings-symbolic.svg new file mode 100644 index 0000000..1879618 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.profile-settings-symbolic.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.profile-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.profile-symbolic.svg new file mode 100644 index 0000000..4bc7b0c --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.profile-symbolic.svg @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git a/icons/com.ublinux.ubl-settings-usergroups.settings-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.settings-symbolic.svg new file mode 100644 index 0000000..67d3487 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.settings-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/com.ublinux.ubl-settings-usergroups.sync-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.sync-symbolic.svg new file mode 100644 index 0000000..13651dd --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.sync-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/com.ublinux.ubl-settings-usergroups.trash-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.trash-symbolic.svg new file mode 100644 index 0000000..03ca715 --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.trash-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/com.ublinux.ubl-settings-usergroups.view-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.view-symbolic.svg new file mode 100644 index 0000000..8e6a1ed --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.view-symbolic.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/com.ublinux.ubl-settings-usergroups.warning.svg b/icons/com.ublinux.ubl-settings-usergroups.warning.svg similarity index 100% rename from com.ublinux.ubl-settings-usergroups.warning.svg rename to icons/com.ublinux.ubl-settings-usergroups.warning.svg diff --git a/icons/com.ublinux.ubl-settings-usergroups.zoom-symbolic.svg b/icons/com.ublinux.ubl-settings-usergroups.zoom-symbolic.svg new file mode 100644 index 0000000..c5011ec --- /dev/null +++ b/icons/com.ublinux.ubl-settings-usergroups.zoom-symbolic.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 56e4492..33d015f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,10 +8,10 @@ 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}) +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) @@ -36,6 +36,10 @@ add_custom_target(GLADE ubl-settings-usergroups.glade) set(DEPENDFILES ../ubl-settings-usergroups.glade + ../ubl-settings-usergroups-additional-settings.glade + ../ubl-settings-usergroups-group-creation.glade + ../ubl-settings-usergroups-password.glade + ../ubl-settings-usergroups-system.glade ../ubl-settings-usergroups-user.glade ../ubl-settings-usergroups-group.glade ../gresource.xml @@ -75,15 +79,15 @@ set(SOURCE_FILES ubl-settings-usergroups.c 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} + ${VTE291_LIBRARIES} + ubl-utils + ublsettings-ui pthread) diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index b149b9c..1843f6e 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -1,409 +1,349 @@ -#include "ubl-settings-usergroups.h" +#include "ubl-settings-usergroups.h" + +config main_config; + +//functions + +void yon_load_proceed(char *command){ + +} + +void yon_save_proceed(char *section,YON_CONFIG_TYPE type){ +} + +void on_filechooser_open(GtkWidget *self, GtkEntry *output_target){ + // ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); + // g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + // gtk_widget_show(window->Window); -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); -} - -void on_toggle_button_switched(GtkToggleButton *self, GtkWidget *widget){ - gtk_widget_set_sensitive(widget,!gtk_toggle_button_get_active(self)); - -} - -//functions - -void on_uid_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->uid = atoi(gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(window->UserUIDEntry)))); -} - -void on_username_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->username = (char*)(gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(window->userUserNameEntry)))); -} - -void on_login_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->login = (char*)(gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(window->userLoginEntry)))); } -void on_password_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->password = (char*)(gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(window->userPasswordEntry)))); -} +void on_groups_clicked(GtkWidget *self, GtkEntry *output_target){ + ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(); + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(window->GroupsTree),0),0); + g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_widget_show(window->GroupsWindow); -void on_group_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->main_group = (char*)(gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(window->userGroupsEntry)))); } -void on_hash_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->password_hash = gtk_combo_box_get_active(GTK_COMBO_BOX(window->userPasswordHashAlgorithmCombo)); -} +void on_groups_multiple_clicked(GtkWidget *self, GtkEntry *output_target){ + ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(); + g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_widget_show(window->GroupsWindow); -void on_extra_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->extra_options = (char*)(gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(window->userExtraOptionsEntry)))); } -void on_user_def_password_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->password=NULL; - user_cfg->password_default = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); - on_toggle_button_switched(GTK_TOGGLE_BUTTON(self),window->userPasswordEntry); -} +void on_password_change(GtkWidget *self, GtkEntry *output_target){ + ubl_settings_usergroups_password_window *window = yon_ubl_settings_usergroups_password_new(); + g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_widget_show(window->CreateGroupWindow); -void on_auto_uid_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->uid=0; - user_cfg->uid_default = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); - on_toggle_button_switched(GTK_TOGGLE_BUTTON(self),window->UserUIDEntry); } -void on_SAMBA_changed(GtkWidget *self, dictionary *dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - user_cfg->sync_SAMBA=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self)); -} - -void on_user_accept(GtkWidget *self, dictionary * dict){ - user_window *window = yon_dictionary_get_data(dict->first,user_window*); - user_config *user_cfg = yon_dictionary_get_data(dict->first->next,user_config*); - main_window *widgets = yon_dictionary_get_data(dict->first->next->next,main_window*); - GtkTreeIter iter; - gtk_list_store_append(main_config.usersListStore,&iter); - gtk_list_store_set(main_config.usersListStore,&iter,(user_cfg->uid_default==0) ? 0 : 1,(user_cfg->uid_default==0) ? user_cfg->uid : 1,2,user_cfg->login, 3,(user_cfg->password_default==0) ? "*******" : _("Default"),5,user_cfg->username,-1); - // widgets->MainUserTree; - on_close_subwindow(self); -} +void on_additional_settings_clicked(GtkWidget *self, GtkEntry *output_target){ + ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_widget_show(window->Window); -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_def_groups_accept(GtkWidget *self, dictionary *windowes){ - char *groups_string = ""; - main_window *widgets = yon_dictionary_get_data(windowes->first->next,main_window*); - groups_window *window = yon_dictionary_get_data(windowes->first,groups_window*); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsAdmCheck))==1) groups_string = yon_char_append(groups_string,"adm,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsAudioCheck))==1) groups_string = yon_char_append(groups_string,"audio,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsAutologinCheck))==1) groups_string = yon_char_append(groups_string,"autologin,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsAvahiCheck))==1) groups_string = yon_char_append(groups_string,"avahi,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsBinCheck))==1) groups_string = yon_char_append(groups_string,"bin,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsBrlapiCheck))==1) groups_string = yon_char_append(groups_string,"brlapi,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsBrittyCheck))==1) groups_string = yon_char_append(groups_string,"britty,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsBumblbeeCheck))==1) groups_string = yon_char_append(groups_string,"bumblbee,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsChronyCheck))==1) groups_string = yon_char_append(groups_string,"chrony,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsClamavCheck))==1) groups_string = yon_char_append(groups_string,"clamav,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsCockpitWsCheck))==1) groups_string = yon_char_append(groups_string,"cockpit-ws,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsCockpitWsinstanceCheck))==1) groups_string = yon_char_append(groups_string,"cockpit-wsinstance,"); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->GroupsColordCheck))==1) groups_string = yon_char_append(groups_string,"colord,"); - if (strcmp(groups_string,"")!=0) groups_string[strlen(groups_string)-1]='\0'; - gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(widgets->MainDefaultGroupsEntry)),groups_string,strlen(groups_string)); - on_close_subwindow(self); +void on_expiration_clicked(GtkWidget *self, GtkEntry *output_target){ + } -void on_groups_open(GtkWidget *self, main_window *widgets){ +// standard functions + + +ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(){ + ubl_settings_usergroups_additional_settings_window *window = malloc(sizeof(ubl_settings_usergroups_additional_settings_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_additional_settings); + window->Window=yon_gtk_builder_get_widget(builder,"Window"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->DefaultUserNameEntry=yon_gtk_builder_get_widget(builder,"DefaultUserNameEntry"); + window->DefaultUserAdministratorCheck=yon_gtk_builder_get_widget(builder,"DefaultUserAdministratorCheck"); + window->DefaultPasswordCombo=yon_gtk_builder_get_widget(builder,"DefaultPasswordCombo"); + window->DefaultPasswordEntry=yon_gtk_builder_get_widget(builder,"DefaultPasswordEntry"); + window->RootPasswordCombo=yon_gtk_builder_get_widget(builder,"RootPasswordCombo"); + window->RootPasswordEntry=yon_gtk_builder_get_widget(builder,"RootPasswordEntry"); + window->PasswordHashCombo=yon_gtk_builder_get_widget(builder,"PasswordHashCombo"); + window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton"); + window->AcceptButton=yon_gtk_builder_get_widget(builder,"AcceptButton"); + g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +return window; } -void on_def_groups_open(GtkWidget *self, main_window *widgets){ - 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"); - - window->GroupsAdmCheck = yon_gtk_builder_get_widget(builder,"groupsAdmGroupCheck"); - window->GroupsAudioCheck = yon_gtk_builder_get_widget(builder,"groupsAudioGroupCheck"); - window->GroupsAutologinCheck = yon_gtk_builder_get_widget(builder,"groupsAutologinGroupCheck"); - window->GroupsAvahiCheck = yon_gtk_builder_get_widget(builder,"groupsAvahiGroupCheck"); - window->GroupsBinCheck = yon_gtk_builder_get_widget(builder,"groupsBinGroupCheck"); - window->GroupsBrlapiCheck = yon_gtk_builder_get_widget(builder,"groupsBrlapiGroupCheck"); - window->GroupsBrittyCheck = yon_gtk_builder_get_widget(builder,"groupsBrittyGroupCheck"); - window->GroupsBumblbeeCheck = yon_gtk_builder_get_widget(builder,"groupsBumblbeeGroupCheck"); - window->GroupsChronyCheck = yon_gtk_builder_get_widget(builder,"groupsChronyGroupCheck"); - window->GroupsClamavCheck = yon_gtk_builder_get_widget(builder,"groupsClamavGroupCheck"); - window->GroupsCockpitWsCheck = yon_gtk_builder_get_widget(builder,"groupsCockpitWsGroupCheck"); - window->GroupsCockpitWsinstanceCheck = yon_gtk_builder_get_widget(builder,"groupsCockpitWsinstanceGroupCheck"); - window->GroupsColordCheck = yon_gtk_builder_get_widget(builder,"groupsColordGroupCheck"); - dictionary *windgets=NULL; - yon_dictionary_add_or_create_if_exists_with_data(windgets,"window",window); - yon_dictionary_add_or_create_if_exists_with_data(windgets,"widgets",widgets); - g_signal_connect(G_OBJECT(window->GroupsCancelButton),"clicked",G_CALLBACK(on_close_subwindow),window); - g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_def_groups_accept),windgets); - gtk_widget_show(window->Window); -} -void on_user_add(GtkWidget *self, main_window *widgets){ - 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"); - - window->UserUIDAutoCheck = yon_gtk_builder_get_widget(builder,"userUIDAutoCheck"); - window->UserUIDEntry = yon_gtk_builder_get_widget(builder,"userUIDEntry"); - window->userUserNameEntry = yon_gtk_builder_get_widget(builder,"userUserNameEntry"); - window->userLoginEntry = yon_gtk_builder_get_widget(builder,"userLoginEntry"); - window->userPasswordDefaultCheck = yon_gtk_builder_get_widget(builder,"userPasswordDefaultCheck"); - window->userPasswordEntry = yon_gtk_builder_get_widget(builder,"userPasswordEntry"); - window->userGroupsEntry = yon_gtk_builder_get_widget(builder,"userGroupsEntry"); - window->userPasswordHashAlgorithmCombo = yon_gtk_builder_get_widget(builder,"userPasswordHashAlgorithmCombo"); - window->userSyncSAMBACheck = yon_gtk_builder_get_widget(builder,"userSyncSAMBACheck"); - window->userExtraOptionsEntry = yon_gtk_builder_get_widget(builder,"userExtraOptionsEntry"); - user_config *user_cfg=malloc(sizeof(user_config)); - user_cfg->username=NULL; - user_cfg->login=NULL; - user_cfg->password=NULL; - user_cfg->main_group=NULL; - user_cfg->additional_groups=NULL; - user_cfg->extra_options=NULL; - user_cfg->uid=-1; - user_cfg->password_default=0; - user_cfg->password_hash=-1; - user_cfg->sync_SAMBA=0; - dictionary *dict = NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window) - yon_dictionary_add_or_create_if_exists_with_data(dict,"config",user_cfg); - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - 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_user_accept),dict); - // g_signal_connect(G_OBJECT(window->UserUIDAutoCheck),"clicked",G_CALLBACK(on_toggle_button_switched),window->UserUIDEntry); - // g_signal_connect(G_OBJECT(window->userPasswordDefaultCheck),"clicked",G_CALLBACK(on_toggle_button_switched),window->UserPasswordEntry); - g_signal_connect(G_OBJECT(window->UserAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_open),NULL); +void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *self, main_window *widgets){ + ubl_settings_usergroups_additional_settings_window *window = yon_ubl_settings_usergroups_additional_settings_new(); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); - g_signal_connect(G_OBJECT(window->UserUIDAutoCheck),"toggled",G_CALLBACK(on_auto_uid_changed),dict); - g_signal_connect(G_OBJECT(window->UserUIDEntry),"changed",G_CALLBACK(on_uid_changed),dict); - g_signal_connect(G_OBJECT(window->userUserNameEntry),"changed",G_CALLBACK(on_username_changed),dict); - g_signal_connect(G_OBJECT(window->userLoginEntry),"changed",G_CALLBACK(on_login_changed),dict); - g_signal_connect(G_OBJECT(window->userPasswordDefaultCheck),"toggled",G_CALLBACK(on_user_def_password_changed),dict); - g_signal_connect(G_OBJECT(window->userPasswordEntry),"changed",G_CALLBACK(on_password_changed),dict); - g_signal_connect(G_OBJECT(window->userGroupsEntry),"changed",G_CALLBACK(on_group_changed),dict); - g_signal_connect(G_OBJECT(window->userPasswordHashAlgorithmCombo),"changed",G_CALLBACK(on_hash_changed),dict); - g_signal_connect(G_OBJECT(window->userSyncSAMBACheck),"toggled",G_CALLBACK(on_SAMBA_changed),dict); - g_signal_connect(G_OBJECT(window->userExtraOptionsEntry),"changed",G_CALLBACK(on_extra_changed),dict); + gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->Window)); gtk_widget_show(window->Window); -} - -void on_user_edit(){ } -void on_user_delete(){ -} +ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(){ + ubl_settings_usergroups_group_creation_window *window = malloc(sizeof(ubl_settings_usergroups_group_creation_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group_creation); + window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"userUIDAutoCheck"); + window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry"); + window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry"); + window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry"); + 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"); + window->AdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"AdditionalGroupsButton"); + window->UnuniqueGIDCheck=yon_gtk_builder_get_widget(builder,"UnuniqueGIDCheck"); + window->SystemGroupCheck=yon_gtk_builder_get_widget(builder,"SystemGroupCheck"); + window->PasswordCombo=yon_gtk_builder_get_widget(builder,"PasswordCombo"); + window->PasswordEntry=yon_gtk_builder_get_widget(builder,"PasswordEntry"); + window->ChangePasswordButton=yon_gtk_builder_get_widget(builder,"ChangePasswordButton"); -void on_def_groups_edit(GtkCellEditable *self, main_window *widgets){ - main_config.default_groups=(char*)gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(widgets->MainDefaultGroupsEntry))); + g_signal_connect(G_OBJECT(window->UnuniqueGIDCheck),"clicked",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userLoginEntry); + g_signal_connect(G_OBJECT(window->AdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userGroupsEntry); + g_signal_connect(G_OBJECT(window->ChangePasswordButton),"clicked",G_CALLBACK(on_password_change),window->PasswordEntry); + g_signal_connect(G_OBJECT(window->UserCancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); +return window; } -void on_def_user_edit(GtkCellEditable *self, main_window *widgets){ - main_config.default_user_name=(char*)gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(widgets->MainDefaultUserNameEntry))); -} -void on_def_admin_edit(GtkWidget *self, main_window *widgets){ - main_config.is_1000_administrator=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->MainDefaultUserAdministratorCheck)); +ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(){ + ubl_settings_usergroups_group_window *window = malloc(sizeof(ubl_settings_usergroups_group_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_group); + window->groupsAdmGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAdmGroupCheck"); + window->groupsAudioGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAudioGroupCheck"); + window->groupsAutologinGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAutologinGroupCheck"); + window->groupsAvahiGroupCheck=yon_gtk_builder_get_widget(builder,"groupsAvahiGroupCheck"); + window->groupsBinGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBinGroupCheck"); + window->groupsBrlapiGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBrlapiGroupCheck"); + window->groupsBrittyGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBrittyGroupCheck"); + window->groupsBumblbeeGroupCheck=yon_gtk_builder_get_widget(builder,"groupsBumblbeeGroupCheck"); + window->groupsChronyGroupCheck=yon_gtk_builder_get_widget(builder,"groupsChronyGroupCheck"); + window->groupsClamavGroupCheck=yon_gtk_builder_get_widget(builder,"groupsClamavGroupCheck"); + window->groupsCockpitWsGroupCheck=yon_gtk_builder_get_widget(builder,"groupsCockpitWsGroupCheck"); + window->groupsCockpitWsinstanceGroupCheck=yon_gtk_builder_get_widget(builder,"groupsCockpitWsinstanceGroupCheck"); + window->groupsColordGroupCheck=yon_gtk_builder_get_widget(builder,"groupsColordGroupCheck"); + window->GroupsWindow=yon_gtk_builder_get_widget(builder,"GroupsWindow"); + window->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree"); + 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_subwindow_close),NULL); +return window; } -void on_def_password_edit(GtkCellEditable *self, main_window *widgets){ - main_config.default_password=(char*)gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(widgets->MainDefaultPasswordEntry))); +void on_standard_groups_open(GtkWidget *self, main_window *widgets){ + ubl_settings_usergroups_group_window *window = yon_ubl_settings_usergroups_group_new(); + g_signal_connect(G_OBJECT(window->GroupsOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + gtk_window_set_transient_for(GTK_WINDOW(window->GroupsWindow),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->GroupsWindow); } -void on_root_password_edit(GtkCellEditable *self, main_window *widgets){ - main_config.root_password=(char*)gtk_entry_buffer_get_text(gtk_entry_get_buffer(GTK_ENTRY(widgets->MainRootPasswordEntry))); + +ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(){ + ubl_settings_usergroups_password_window *window = malloc(sizeof(ubl_settings_usergroups_password_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_password); + window->CreateGroupWindow=yon_gtk_builder_get_widget(builder,"CreateGroupWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + 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_subwindow_close),NULL); +return window; } -void on_hash_edit(GtkWidget *self, main_window *widgets){ - main_config.hash_alg=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->MainPasswordHashCombo)); -} -// 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_config.default_groups = NULL; - main_config.default_groups_config = NULL; - main_config.default_password = NULL; - main_config.default_user_name = NULL; - main_config.is_1000_administrator=0; - main_config.hash_alg=0; - main_config.root_password=NULL; +ubl_settings_usergroups_system_window *yon_ubl_settings_usergroups_system_new(){ + ubl_settings_usergroups_system_window *window = malloc(sizeof(ubl_settings_usergroups_system_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_system); + window->liststore1=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1")); + window->liststore2=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore2")); + window->MonitorWindow=yon_gtk_builder_get_widget(builder,"MonitorWindow"); + window->SettingsBar=yon_gtk_builder_get_widget(builder,"SettingsBar"); +return window; } -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"); +void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets){ + ubl_settings_usergroups_system_window *window = yon_ubl_settings_usergroups_system_new(); - 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"); + gtk_window_set_transient_for(GTK_WINDOW(window->MonitorWindow),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->MonitorWindow); +} + + + + + + + + +ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ + ubl_settings_usergroups_user_window *window = malloc(sizeof(ubl_settings_usergroups_user_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_ubl_settings_usergroups_user); + window->CreateUserWindow=yon_gtk_builder_get_widget(builder,"CreateUserWindow"); + window->StatusBox=yon_gtk_builder_get_widget(builder,"StatusBox"); + window->userUIDAutoCheck=yon_gtk_builder_get_widget(builder,"userUIDAutoCheck"); + window->userUIDEntry=yon_gtk_builder_get_widget(builder,"userUIDEntry"); + window->userLoginEntry=yon_gtk_builder_get_widget(builder,"userLoginEntry"); + window->userPasswordCombo=yon_gtk_builder_get_widget(builder,"userPasswordCombo"); + window->userPasswordEntry=yon_gtk_builder_get_widget(builder,"userPasswordEntry"); + window->userPasswordButton=yon_gtk_builder_get_widget(builder,"userPasswordButton"); + window->userUserNameEntry=yon_gtk_builder_get_widget(builder,"userUserNameEntry"); + window->userGroupsCheck=yon_gtk_builder_get_widget(builder,"userGroupsCheck"); + window->userGroupsEntry=yon_gtk_builder_get_widget(builder,"userGroupsEntry"); + window->UserGroupsButton=yon_gtk_builder_get_widget(builder,"UserGroupsButton"); + window->userAdditionalGroupsEntry=yon_gtk_builder_get_widget(builder,"userAdditionalGroupsEntry"); + window->userAdditionalGroupsButton=yon_gtk_builder_get_widget(builder,"userAdditionalGroupsButton"); + window->userPasswordChangedEntry=yon_gtk_builder_get_widget(builder,"userPasswordChangedEntry"); + window->userPasswordExpirationEntry=yon_gtk_builder_get_widget(builder,"userPasswordExpirationEntry"); + window->userPasswordExpirationButton=yon_gtk_builder_get_widget(builder,"userPasswordExpirationButton"); + window->userPasswordChangeDelayMinimumSpin=yon_gtk_builder_get_widget(builder,"userPasswordChangeDelayMinimumSpin"); + window->userPasswordChangeDelayMaximumSpin=yon_gtk_builder_get_widget(builder,"userPasswordChangeDelayMaximumSpin"); + window->userWarningSpin=yon_gtk_builder_get_widget(builder,"userWarningSpin"); + window->userActivitySpin=yon_gtk_builder_get_widget(builder,"userActivitySpin"); + window->userForceChangeCheck=yon_gtk_builder_get_widget(builder,"userForceChangeCheck"); + window->userShellCombo=yon_gtk_builder_get_widget(builder,"userShellCombo"); + window->userShellEntry=yon_gtk_builder_get_widget(builder,"userShellEntry"); + window->userHomeCombo=yon_gtk_builder_get_widget(builder,"userHomeCombo"); + window->userHomeEntry=yon_gtk_builder_get_widget(builder,"userHomeEntry"); + window->userHomeButton=yon_gtk_builder_get_widget(builder,"userHomeButton"); + window->userCreateSystemCheck=yon_gtk_builder_get_widget(builder,"userCreateSystemCheck"); + window->userCreateUnuniqueCheck=yon_gtk_builder_get_widget(builder,"userCreateUnuniqueCheck"); + window->userDontCheckCheck=yon_gtk_builder_get_widget(builder,"userDontCheckCheck"); + window->userSyncSAMBACheck=yon_gtk_builder_get_widget(builder,"userSyncSAMBACheck"); + window->userDeactivatedCheck=yon_gtk_builder_get_widget(builder,"userDeactivatedCheck"); + window->userExtraOptionsEntry=yon_gtk_builder_get_widget(builder,"userExtraOptionsEntry"); + 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_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->userUIDAutoCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button_inversed),window->userUIDEntry); + g_signal_connect(G_OBJECT(window->userHomeButton),"clicked",G_CALLBACK(on_filechooser_open),window->userHomeEntry); + g_signal_connect(G_OBJECT(window->UserGroupsButton),"clicked",G_CALLBACK(on_groups_clicked),window->userGroupsEntry); + g_signal_connect(G_OBJECT(window->userPasswordButton),"clicked",G_CALLBACK(on_password_change),window->userPasswordEntry); + g_signal_connect(G_OBJECT(window->userAdditionalGroupsButton),"clicked",G_CALLBACK(on_groups_multiple_clicked),window->userAdditionalGroupsEntry); + g_signal_connect(G_OBJECT(window->userPasswordExpirationButton),"clicked",G_CALLBACK(on_expiration_clicked),window->userPasswordExpirationEntry); +return window; +} + +void on_main_add(GtkWidget *self, main_window *widgets){ + GtkTreeModel *model; + GtkWidget *cur_tree; + GtkTreeIter iter; + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){ + model = GTK_TREE_MODEL(widgets->UsersList); + ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new(); + g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->CreateUserWindow); + } else { + model = GTK_TREE_MODEL(widgets->GroupsList); + ubl_settings_usergroups_group_creation_window *window = yon_ubl_settings_usergroups_group_creation_new(); + g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->CreateGroupWindow); + } + +} + +void on_main_edit(GtkWidget *self, main_window *widgets){ + GtkTreeModel *model; + GtkWidget *cur_tree; + GtkTreeIter iter; + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){ + model = GTK_TREE_MODEL(widgets->UsersList); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)){ + ubl_settings_usergroups_user_window *window = yon_ubl_settings_usergroups_user_new(); + g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->CreateUserWindow); + } + } else { + model = GTK_TREE_MODEL(widgets->GroupsList); + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->GroupsTree)),&model,&iter)){ + ubl_settings_usergroups_group_creation_window *window = yon_ubl_settings_usergroups_group_creation_new(); + g_signal_connect(G_OBJECT(window->UserOkButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + gtk_window_set_transient_for(GTK_WINDOW(window->CreateGroupWindow),GTK_WINDOW(widgets->Window)); + gtk_widget_show(window->CreateGroupWindow); + } + } + +} + +void on_main_delete(GtkWidget *self, main_window *widgets){ + GtkTreeModel *model; + GtkWidget *cur_tree; + GtkTreeIter iter; + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))==0){ + model = GTK_TREE_MODEL(widgets->UsersList); + cur_tree=widgets->UsersTree; + } else { + model = GTK_TREE_MODEL(widgets->GroupsList); + cur_tree=widgets->GroupsTree; + } + if(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(cur_tree)),&model,&iter)){ + gtk_list_store_remove(GTK_LIST_STORE(model),&iter); + } +} + + +/**config_init() + * [EN] + * + * [RU] + * Функция инициализации всех параметров конфигурации +*/ +void config_init(){ + main_config.always_open_documentation=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; +} + +/**yon_main_window_complete(main_window *widgets) + * [EN] + * + * [RU] + * Функция настройки основного окна приложения. [widgets] - структура со стандартным интерфейсом. +*/ +void yon_main_window_complete(main_window *widgets){ + widgets = yon_remalloc(widgets,sizeof(main_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(glade_path); + gtk_box_pack_start(GTK_BOX(widgets->InterfaceBox),yon_gtk_builder_get_widget(builder,"PlugBox"),1,1,0); + // Custom widgets configuration - widgets->MainEditGroupsButton = yon_gtk_builder_get_widget(builder,"MainEditGroupsButton"); - - widgets->MainDefaultGroupsEntry = yon_gtk_builder_get_widget(builder,"mainDefaultGroupsEntry"); - widgets->MainDefaultUserNameEntry = yon_gtk_builder_get_widget(builder,"mainDefaultUserNameEntry"); - widgets->MainDefaultUserAdministratorCheck = yon_gtk_builder_get_widget(builder,"mainDefaultUserAdministratorCheck"); - widgets->MainDefaultPasswordEntry = yon_gtk_builder_get_widget(builder,"mainDefaultPasswordEntry"); - widgets->MainRootPasswordEntry = yon_gtk_builder_get_widget(builder,"mainRootPasswordEntry"); - widgets->MainUserTree = yon_gtk_builder_get_widget(builder,"mainUserTree"); - widgets->MainPasswordHashCombo = yon_gtk_builder_get_widget(builder,"mainPasswordHashCombo"); - - main_config.usersListStore = GTK_LIST_STORE(gtk_builder_get_object(builder,"UserList")); + widgets->CacheAlgList=GTK_LIST_STORE(gtk_builder_get_object(builder,"CacheAlgList")); + widgets->GroupsList=GTK_LIST_STORE(gtk_builder_get_object(builder,"GroupsList")); + widgets->UsersList=GTK_LIST_STORE(gtk_builder_get_object(builder,"UsersList")); + widgets->PlugBox=yon_gtk_builder_get_widget(builder,"PlugBox"); + widgets->button1=yon_gtk_builder_get_widget(builder,"button1"); + widgets->button2=yon_gtk_builder_get_widget(builder,"button2"); + widgets->button3=yon_gtk_builder_get_widget(builder,"button3"); + widgets->AddButton=yon_gtk_builder_get_widget(builder,"AddButton"); + widgets->EditButton=yon_gtk_builder_get_widget(builder,"EditButton"); + widgets->DeleteButton=yon_gtk_builder_get_widget(builder,"DeleteButton"); + widgets->UpdateButton=yon_gtk_builder_get_widget(builder,"UpdateButton"); + widgets->UsersTree=yon_gtk_builder_get_widget(builder,"UsersTree"); + widgets->GroupsTree=yon_gtk_builder_get_widget(builder,"GroupsTree"); + widgets->MainNotebook=yon_gtk_builder_get_widget(builder,"MainNotebook"); + + main_config.usersListStore = GTK_LIST_STORE(gtk_builder_get_object(builder,"UsersList")); + main_config.groupsListStore = GTK_LIST_STORE(gtk_builder_get_object(builder,"GroupsList")); if (main_config.lock_load_global == 1){ @@ -419,117 +359,97 @@ main_window *setup_window(){ } /* 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),widgets); - 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_def_groups_open),widgets); - g_signal_connect(G_OBJECT(widgets->MainDefaultGroupsEntry),"changed",G_CALLBACK(on_def_groups_edit),widgets); - g_signal_connect(G_OBJECT(widgets->MainDefaultUserNameEntry),"changed",G_CALLBACK(on_def_user_edit),widgets); - g_signal_connect(G_OBJECT(widgets->MainDefaultUserAdministratorCheck),"toggled",G_CALLBACK(on_def_admin_edit),widgets); - g_signal_connect(G_OBJECT(widgets->MainDefaultPasswordEntry),"changed",G_CALLBACK(on_def_password_edit),widgets); - g_signal_connect(G_OBJECT(widgets->MainRootPasswordEntry),"changed",G_CALLBACK(on_root_password_edit),widgets); - g_signal_connect(G_OBJECT(widgets->MainPasswordHashCombo),"changed",G_CALLBACK(on_hash_edit),widgets); + g_signal_connect(G_OBJECT(widgets->AddButton),"clicked",G_CALLBACK(on_main_add),widgets); + g_signal_connect(G_OBJECT(widgets->EditButton),"clicked",G_CALLBACK(on_main_edit),widgets); + g_signal_connect(G_OBJECT(widgets->DeleteButton),"clicked",G_CALLBACK(on_main_delete),widgets); + g_signal_connect(G_OBJECT(widgets->button3),"clicked",G_CALLBACK(on_standard_groups_open),widgets); + g_signal_connect(G_OBJECT(widgets->button2),"clicked",G_CALLBACK(on_ubl_settings_usergroups_additional_settings_open),widgets); + g_signal_connect(G_OBJECT(widgets->button1),"clicked",G_CALLBACK(on_settings_usergroups_system_open),widgets); 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(LOCAL_LOAD_SUCCESS_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(); +} + +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'}, + {"clear-config", 0,0, 'c'}, + { NULL, 0, NULL, 0 } + }; + for (int i=0;i -#include -#include "ubl-utils.h" -#include -#include -#include -#include -#include -#include -#include -#include "../compile/ubl-cmake.h" -#ifdef WEBKIT_FOUND - #include -#endif -#include "ubl-strings.h" - -#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubl-settings-usergroups" - -#define _(String) gettext(String) - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../compile/ubl-cmake.h" +#ifdef WEBKIT_FOUND + #include +#endif +#include "ubl-strings.h" + +#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 glade_path_ubl_settings_usergroups_additional_settings "/com/ublinux/ui/ubl-settings-usergroups-additional-settings.glade" +#define glade_path_ubl_settings_usergroups_group_creation "/com/ublinux/ui/ubl-settings-usergroups-group-creation.glade" +#define glade_path_ubl_settings_usergroups_group "/com/ublinux/ui/ubl-settings-usergroups-group.glade" +#define glade_path_ubl_settings_usergroups_password "/com/ublinux/ui/ubl-settings-usergroups-password.glade" +#define glade_path_ubl_settings_usergroups_system "/com/ublinux/ui/ubl-settings-usergroups-system.glade" +#define glade_path_ubl_settings_usergroups_user "/com/ublinux/ui/ubl-settings-usergroups-user.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; +#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) + +#define LocalePath "/usr/share/locale" +#define LocaleName "ubl-settings-usergroups" + +#define clear_config_both_command "ubconfig remove TEMP_SECTION TEMP_PATAMETER" +#define clear_config_global_command "ubconfig --target global remove TEMP_SECTION TEMP_PATAMETER" +#define clear_config_local_command "ubconfig --target system remove TEMP_SECTION TEMP_PATAMETER" + +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; - - // Custom - char *default_groups; - char *default_user_name; - char *default_password; - char *root_password; - int hash_alg; - gboolean is_1000_administrator; - struct groups_config *default_groups_config; + +char *local; + +typedef struct { +// Standard config. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_config STRUCT { + 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; + + int always_open_documentation; +// } Standard config. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_config STRUCT +// Type custom parameters below: : GtkListStore *usersListStore; - } 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; - // Custom - GtkWidget *MainAddUserButton; - GtkWidget *MainEditUserButton; - GtkWidget *MainDeleteUserButton; - - GtkWidget *MainEditGroupsButton; - - GtkWidget *MainDefaultGroupsEntry; - GtkWidget *MainDefaultUserNameEntry; - GtkWidget *MainDefaultUserAdministratorCheck; - GtkWidget *MainDefaultPasswordEntry; - GtkWidget *MainRootPasswordEntry; - GtkWidget *MainPasswordHashCombo; - - GtkWidget *MainUserTree; - -} main_window; - -typedef struct { - gboolean adm; - gboolean audio; - gboolean autologin; - gboolean avahi; - gboolean bin; - gboolean brlapi; - gboolean britty; - gboolean bumblbee; - gboolean chrony; - gboolean clamav; - gboolean cockpit_ws; - gboolean cockpit_wsinstance; - gboolean colord; -} groups_config; - -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; - - GtkWidget *GroupsAdmCheck; - GtkWidget *GroupsAudioCheck; - GtkWidget *GroupsAutologinCheck; - GtkWidget *GroupsAvahiCheck; - GtkWidget *GroupsBinCheck; - GtkWidget *GroupsBrlapiCheck; - GtkWidget *GroupsBrittyCheck; - GtkWidget *GroupsBumblbeeCheck; - GtkWidget *GroupsChronyCheck; - GtkWidget *GroupsClamavCheck; - GtkWidget *GroupsCockpitWsCheck; - GtkWidget *GroupsCockpitWsinstanceCheck; - GtkWidget *GroupsColordCheck; -} groups_window; - -typedef struct { - int uid; - gboolean uid_default; - char *username; - char *login; - char *password; - gboolean password_default; - char *main_group; - struct groups_config *additional_groups; - int password_hash; - gboolean sync_SAMBA; - char *extra_options; -} user_config; - -typedef struct { - GtkWidget *Window; - GtkWidget *UserAdditionalGroupsButton; - GtkWidget *UserCancelButton; - GtkWidget *UserOkButton; - - GtkWidget *UserUIDAutoCheck; - GtkWidget *UserUIDEntry; - GtkWidget *userUserNameEntry; - GtkWidget *userLoginEntry; - GtkWidget *userPasswordDefaultCheck; - GtkWidget *userPasswordEntry; - GtkWidget *userGroupsEntry; - GtkWidget *userPasswordHashAlgorithmCombo; - GtkWidget *userSyncSAMBACheck; - GtkWidget *userExtraOptionsEntry; -} user_window; - -main_window *setup_window(); \ No newline at end of file + GtkListStore *groupsListStore; + +} config; + +typedef struct { +// Standard widgets. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_main_window STRUCT { + GtkWidget *Window; + GtkWidget *HeadLabel; + GtkWidget *PlugBox; + + GtkWidget *HeadOverlay; + GtkWidget *HeadImage; + GtkWidget *HeadBox; + GtkWidget *HeadTitleLabel; + GtkWidget *HeadInfoLabel; + + GtkWidget *StatusBox; + GtkWidget *StatusIcon; + GtkWidget *StatusLabel; + + GtkWidget *SaveMenuItem; + GtkWidget *SaveGlobalMenuItem; + GtkWidget *SaveLocalMenuItem; + GtkWidget *RightBox; + + GtkWidget *LoadGlobalMenuItem; + GtkWidget *LoadLocalMenuItem; + GtkWidget *LeftBox; + + GtkWidget *DocumentationMenuItem; + GtkWidget *AboutMenuItem; + + GtkWidget *InterfaceBox; +// } Standard widgets. DO NOT EDIT - MUST BE SAME AS ublsettings-ui's template_main_window STRUCT +// Type custom parameters below: + GtkListStore *CacheAlgList; + GtkListStore *GroupsList; + GtkListStore *UsersList; + GtkWidget *button1; + GtkWidget *button2; + GtkWidget *button3; + GtkWidget *AddButton; + GtkWidget *EditButton; + GtkWidget *DeleteButton; + GtkWidget *UpdateButton; + GtkWidget *UsersTree; + GtkWidget *GroupsTree; + GtkWidget *MainNotebook; + +} main_window; + + +typedef struct { + GtkWidget *Window; + + GtkWidget *AlwaysOpenCheck; + + GtkWidget *CloseButton; + GtkWidget *AcceptButton; +} documentation_confirmation_window; + +typedef struct{ + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *DefaultUserNameEntry; + GtkWidget *DefaultUserAdministratorCheck; + GtkWidget *DefaultPasswordCombo; + GtkWidget *DefaultPasswordEntry; + GtkWidget *RootPasswordCombo; + GtkWidget *RootPasswordEntry; + GtkWidget *PasswordHashCombo; + GtkWidget *CancelButton; + GtkWidget *AcceptButton; +} ubl_settings_usergroups_additional_settings_window; + +typedef struct{ + GtkWidget *CreateGroupWindow; + GtkWidget *StatusBox; + GtkWidget *userUIDAutoCheck; + GtkWidget *userUIDEntry; + GtkWidget *userLoginEntry; + GtkWidget *userGroupsEntry; + GtkWidget *UserAdditionalGroupsButton; + GtkWidget *UserCancelButton; + GtkWidget *UserOkButton; + GtkWidget *AdditionalGroupsButton; + GtkWidget *UnuniqueGIDCheck; + GtkWidget *SystemGroupCheck; + GtkWidget *PasswordCombo; + GtkWidget *PasswordEntry; + GtkWidget *ChangePasswordButton; +} ubl_settings_usergroups_group_creation_window; + +typedef struct{ + GtkWidget *groupsAdmGroupCheck; + GtkWidget *groupsAudioGroupCheck; + GtkWidget *groupsAutologinGroupCheck; + GtkWidget *groupsAvahiGroupCheck; + GtkWidget *groupsBinGroupCheck; + GtkWidget *groupsBrlapiGroupCheck; + GtkWidget *groupsBrittyGroupCheck; + GtkWidget *groupsBumblbeeGroupCheck; + GtkWidget *groupsChronyGroupCheck; + GtkWidget *groupsClamavGroupCheck; + GtkWidget *groupsCockpitWsGroupCheck; + GtkWidget *groupsCockpitWsinstanceGroupCheck; + GtkWidget *groupsColordGroupCheck; + GtkWidget *GroupsWindow; + GtkWidget *GroupsTree; + GtkWidget *GroupsCancelButton; + GtkWidget *GroupsOkButton; +} ubl_settings_usergroups_group_window; + +typedef struct{ + GtkWidget *CreateGroupWindow; + GtkWidget *StatusBox; + GtkWidget *UserCancelButton; + GtkWidget *UserOkButton; +} ubl_settings_usergroups_password_window; + +typedef struct{ + GtkListStore *liststore1; + GtkListStore *liststore2; + GtkWidget *MonitorWindow; + GtkWidget *SettingsBar; +} ubl_settings_usergroups_system_window; + +typedef struct{ + GtkWidget *CreateUserWindow; + GtkWidget *StatusBox; + GtkWidget *userUIDAutoCheck; + GtkWidget *userUIDEntry; + GtkWidget *userLoginEntry; + GtkWidget *userPasswordCombo; + GtkWidget *userPasswordEntry; + GtkWidget *userPasswordButton; + GtkWidget *userUserNameEntry; + GtkWidget *userGroupsCheck; + GtkWidget *userGroupsEntry; + GtkWidget *UserGroupsButton; + GtkWidget *userAdditionalGroupsEntry; + GtkWidget *userAdditionalGroupsButton; + GtkWidget *userPasswordChangedEntry; + GtkWidget *userPasswordExpirationEntry; + GtkWidget *userPasswordExpirationButton; + GtkWidget *userPasswordChangeDelayMinimumSpin; + GtkWidget *userPasswordChangeDelayMaximumSpin; + GtkWidget *userWarningSpin; + GtkWidget *userActivitySpin; + GtkWidget *userForceChangeCheck; + GtkWidget *userShellCombo; + GtkWidget *userShellEntry; + GtkWidget *userHomeCombo; + GtkWidget *userHomeEntry; + GtkWidget *userHomeButton; + GtkWidget *userCreateSystemCheck; + GtkWidget *userCreateUnuniqueCheck; + GtkWidget *userDontCheckCheck; + GtkWidget *userSyncSAMBACheck; + GtkWidget *userDeactivatedCheck; + GtkWidget *userExtraOptionsEntry; + GtkWidget *UserCancelButton; + GtkWidget *UserOkButton; +} ubl_settings_usergroups_user_window; + + +ubl_settings_usergroups_additional_settings_window *yon_ubl_settings_usergroups_additional_settings_new(); + +void on_ubl_settings_usergroups_additional_settings_open(GtkWidget *self, main_window *widgets); + +ubl_settings_usergroups_group_creation_window *yon_ubl_settings_usergroups_group_creation_new(); + +ubl_settings_usergroups_group_window *yon_ubl_settings_usergroups_group_new(); + +void on_standard_groups_open(GtkWidget *self, main_window *widgets); + +ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_new(); + +ubl_settings_usergroups_system_window *yon_ubl_settings_usergroups_system_new(); + +void on_settings_usergroups_system_open(GtkWidget *self, main_window *widgets); + +ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(); \ No newline at end of file diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 56da4ea..cfe1e13 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -4,39 +4,6 @@ #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") @@ -58,4 +25,65 @@ #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 +#define EXTRA_OPTIONS_USER_LABEL _("Extra options:") +#define CANCEL_LABEL _("Cancel") +#define OK_LABEL _("Ok") + +#define BLOCK_LABEL _("Block") +#define MAIN_GROUP_LABEL _("Main group") +#define ADDITIONAL_PARAMETERS_LABEL _("Additional parameters") +#define PASSWORD_STATUS_LABEL _("Password status") +#define USERS_LABEL _("Users") +#define GID_LABEL _("GID") +#define GROUP_NAME_LABEL _("Group name") +#define GROUPS_USERS_LABEL _("Group users") +#define GROUPS_LABEL _("Groups") + +//ubl-settings-usergroups-additional-settings.glade +#define SET_PASSWORD_LABEL _("Set a password") +#define ENDRYPTED_LABEL _("Endrypted password") +#define MD5_LABEL "md5" +#define YESCRYPT_LABEL "yescrypt" +#define NO_PASSWORD_LABEL _("No password required") +#define SCRYPT_LABEL "scrypt" +#define BF_LABEL "bf" +#define BCRYPT_LABEL "bcrypt" +#define SHA512_LABEL "sha512crypt" +#define SHA256_LABEL "sha256crypt" +#define SUNMD_LABEL "sunmd5" +#define MD5CRYPT_LABEL "md5crypt" +#define BSDICRYPT_LABEL "bsdicrypt" +#define DESCTRYPT_LABEL "desctrypt" +#define NT_LABEL "nt" +#define ACCEPT_LABEL _("Accept") + +//ubl-settings-usergroups-group-creation.glade +#define AUTOMATICALLY_LABEL _("Automatically") +#define LOGIN_GROUP_LABEL _("login") +#define CREATE_GROUP_UNUNIQUE_LABEL _("Create group with ununique GID") +#define CREATE_SYSTEM_GROUP_LABEL _("Create system group") +#define ENCRYPTED_PASSWORD_LABEL _("Encrypted password") +#define ADDITIONAL_CONFIGURATION_LABEL _("Additional configuration") + +//ubl-settings-usergroups-group.glade +#define ADM_LABEL "adm" +#define AUDIO_LABEL "audio" +#define AUTOLIGIN_LABEL "autologin" +#define AVAHI_LABEL "avahi" +#define BIN_LABEL "bin" +#define BRLAPI_LABEL "brlapi" +#define BRITTY_LABEL "britty" +#define BUMBLBEE_LABEL "bumblbee" +#define CHRONY_LABEL "chrony" +#define CLAMAV_LABEL "clamav" +#define COLORD_LABEL "colord" + +//ubl-settings-usergroups-system.glade +#define BLOCKED_LABEL _("Blocked") +#define USERNAME_LABEL _("Username") +#define PRIMARY_GROUP_LABEL _("Primary group") +#define HOME_DIRECTORY_LABEL _("Home directory") +#define GROUP_LABEL _("Group") + +#define GROUP_LABEL _("Group") +#define GROUP_LABEL _("Group") \ No newline at end of file diff --git a/source/ubl-utils.c b/source/ubl-utils.c deleted file mode 100644 index 7358272..0000000 --- a/source/ubl-utils.c +++ /dev/null @@ -1,1645 +0,0 @@ -#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){ - 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 deleted file mode 100644 index 01281cd..0000000 --- a/source/ubl-utils.h +++ /dev/null @@ -1,340 +0,0 @@ -#ifndef UBL_UTILS -#define UBL_UTILS -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../compile/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) - -#define get_pkexec_user_command "getent passwd $PKEXEC_UID | cut -d: -f1" - -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-additional-settings.glade b/ubl-settings-usergroups-additional-settings.glade new file mode 100644 index 0000000..d088cc7 --- /dev/null +++ b/ubl-settings-usergroups-additional-settings.glade @@ -0,0 +1,373 @@ + + + + + + + True + False + com.ublinux.ubl-settings-usergroups.cancel-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + 600 + 350 + False + False + True + com.ublinux.ubl-settings-usergroups + + + True + False + 5 + 5 + 5 + vertical + 5 + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + 5 + 5 + Default user name (if there's no another): + 0 + + + False + True + 0 + + + + + True + True + com.ublinux.ubl-settings-usergroups.profile-symbolic + + + True + True + 1 + + + + + False + True + 0 + + + + + User with ID 1000 is administrator + True + True + False + True + + + False + True + 1 + + + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + 5 + 5 + Default user password: + 0 + + + False + True + 0 + + + + + True + False + 0 + + Default + No password required + Set a password + Endrypted password + + + + False + True + 1 + + + + + True + True + 30 + False + * + com.ublinux.ubl-settings-usergroups.key-symbolic + ******** + password + + + True + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Root user password: + 0 + + + False + True + 0 + + + + + True + False + 0 + + Default + No password required + Set a password + Encrypted password + + + + False + True + 1 + + + + + True + True + 30 + False + * + com.ublinux.ubl-settings-usergroups.key-symbolic + ******** + password + + + True + True + end + 2 + + + + + False + True + 3 + + + + + False + True + 3 + + + + + True + False + 5 + + + True + False + 5 + 5 + Password hash algorythm: + 0 + + + False + True + 0 + + + + + True + False + 0 + + md5 + yescrypt + ghost-yescrypt + scrypt + bf + bcrypt + bcrypt-a + sha512crypt + sha256crypt + sunmd5 + md5crypt + bsdicrypt + desctrypt + nt + + + + True + True + 1 + + + + + False + True + 4 + + + + + False + True + 1 + + + + + True + False + end + 5 + + + Cancel + True + True + True + image1 + + + False + True + 0 + + + + + Accept + True + True + True + image2 + + + False + True + 1 + + + + + False + True + end + 2 + + + + + + + True + False + True + + + True + False + Users and groups + + + + + + + + + + + + + + + + diff --git a/ubl-settings-usergroups-group-creation.glade b/ubl-settings-usergroups-group-creation.glade new file mode 100644 index 0000000..3d1a328 --- /dev/null +++ b/ubl-settings-usergroups-group-creation.glade @@ -0,0 +1,429 @@ + + + + + + + True + False + com.ublinux.ubl-settings-usergroups.profile-settings-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.edit-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.cancel-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + False + False + True + 450 + com.ublinux.ubl-settings-usergroups + + + True + False + 5 + vertical + 5 + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + Group Id: + 0 + + + False + True + 0 + + + + + Automatically + True + True + False + True + + + False + True + 2 + + + + + True + True + 1007 + number + + + True + True + 4 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Group name: + 0 + + + False + True + 0 + + + + + True + True + com.ublinux.ubl-settings-usergroups.profile-symbolic + login + + + True + True + 1 + + + + + False + True + 2 + + + + + True + False + 5 + + + True + False + Group users: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 2 + + + + + True + True + True + image1 + + + + False + True + 3 + + + + + False + True + 4 + + + + + False + True + 1 + + + + + True + False + end + 5 + 5 + 5 + True + + + Cancel + True + True + True + image4 + + + + True + True + 0 + + + + + Save + True + True + True + image5 + + + + True + True + 1 + + + + + False + True + end + 1 + + + + + True + False + 5 + 5 + 0 + in + + + True + False + 5 + 5 + 5 + + + True + False + vertical + 5 + + + Create group with ununique GID + True + True + False + True + + + False + True + 0 + + + + + Create system group + True + True + False + True + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Password: + + + False + True + 0 + + + + + True + False + 0 + + Default + No password required + Set a password + Encrypted password + + + + True + True + 1 + + + + + True + True + False + * + com.ublinux.ubl-settings-usergroups.key-symbolic + ******** + + + True + True + 2 + + + + + True + True + True + image2 + + + + False + True + 3 + + + + + False + True + 2 + + + + + + + + + True + False + Additional configuration + + + + + False + True + 3 + + + + + + + True + False + True + + + True + False + Users and groups + + + + + + + + + + + + + + + + diff --git a/ubl-settings-usergroups-group.glade b/ubl-settings-usergroups-group.glade index ac621cb..ee79aea 100644 --- a/ubl-settings-usergroups-group.glade +++ b/ubl-settings-usergroups-group.glade @@ -2,17 +2,207 @@ + + + True + False + vertical + + + adm + True + True + False + True + + + False + True + 0 + + + + + audio + True + True + False + True + + + False + True + 1 + + + + + autologin + True + True + False + True + + + False + True + 2 + + + + + avahi + True + True + False + True + + + False + True + 3 + + + + + bin + True + True + False + True + + + False + True + 4 + + + + + brlapi + True + True + False + True + + + False + True + 5 + + + + + britty + True + True + False + True + + + False + True + 6 + + + + + bumblbee + True + True + False + True + + + False + True + 7 + + + + + chrony + True + True + False + True + + + False + True + 8 + + + + + clamav + True + True + False + True + + + False + True + 9 + + + + + cockpit-ws + True + True + False + True + + + False + True + 10 + + + + + cockpit-wsinstance + True + True + False + True + + + False + True + 11 + + + + + colord + True + True + False + True + + + False + True + 12 + + + True False - process-stop-symbolic + com.ublinux.ubl-settings-usergroups.cancel-symbolic True False - emblem-ok-symbolic + com.ublinux.ubl-settings-usergroups.accept-symbolic + 250 + 385 False False True @@ -28,193 +218,41 @@ 5 5 vertical - 10 + 5 - + True - False - vertical - - - adm - True - True - False - True - - - False - True - 0 - - - - - audio - True - True - False - True - - - False - True - 1 - - - - - autologin - True - True - False - True - - - False - True - 2 - - - - - avahi - True - True - False - True - - - False - True - 3 - - - - - bin - True - True - False - True - - - False - True - 4 - - + True + in - - brlapi + True True - False - True + + + + + + + + + 0 + + + + + + + Group + + + + 1 + + + + - - False - True - 5 - - - - - britty - True - True - False - True - - - False - True - 6 - - - - - bumblbee - True - True - False - True - - - False - True - 7 - - - - - chrony - True - True - False - True - - - False - True - 8 - - - - - clamav - True - True - False - True - - - False - True - 9 - - - - - cockpit-ws - True - True - False - True - - - False - True - 10 - - - - - cockpit-wsinstance - True - True - False - True - - - False - True - 11 - - - - - colord - True - True - False - True - - - False - True - 12 - @@ -227,7 +265,8 @@ True False - 30 + end + 5 True @@ -278,7 +317,7 @@ False True - + True False Users and groups diff --git a/ubl-settings-usergroups-password.glade b/ubl-settings-usergroups-password.glade new file mode 100644 index 0000000..cbe7be8 --- /dev/null +++ b/ubl-settings-usergroups-password.glade @@ -0,0 +1,328 @@ + + + + + + + True + False + com.ublinux.ubl-settings-usergroups.view-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.view-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.view-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.cancel-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + False + False + True + 450 + com.ublinux.ubl-settings-usergroups + + + True + False + 5 + vertical + 5 + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + end + 5 + 5 + 5 + 5 + True + + + Cancel + True + True + True + image4 + + + + True + True + 0 + + + + + Save + True + True + True + image5 + + + + True + True + 1 + + + + + False + True + end + 1 + + + + + True + False + 5 + 5 + vertical + 5 + + + True + False + 5 + + + True + False + Parrword: + 0 + + + False + True + 0 + + + + + True + True + False + * + com.ublinux.ubl-settings-usergroups.key-symbolic + ******** + + + True + True + 1 + + + + + True + True + True + image3 + + + + False + True + 2 + + + + + True + True + 0 + + + + + True + False + 5 + + + True + False + Repeat password: + 0 + + + False + True + 0 + + + + + True + True + False + * + com.ublinux.ubl-settings-usergroups.key-symbolic + ******** + + + True + True + 1 + + + + + True + True + True + image1 + + + + False + True + 2 + + + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + True + False + 5 + + + True + False + Password hash: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + True + True + True + image2 + + + + False + True + 2 + + + + + True + True + 3 + + + + + False + True + 2 + + + + + + + True + False + True + + + True + False + Users and groups + + + + + + + + + + + + + + + + diff --git a/ubl-settings-usergroups-system.glade b/ubl-settings-usergroups-system.glade new file mode 100644 index 0000000..0403f40 --- /dev/null +++ b/ubl-settings-usergroups-system.glade @@ -0,0 +1,212 @@ + + + + + + + True + False + com.ublinux.ubl-settings-usergroups.funnel-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.sync-symbolic + + + + + 800 + 600 + False + False + com.ublinux.ubl-settings-usergroups + + + True + False + 5 + 5 + 5 + 5 + 5 + + + True + False + vertical + 5 + + + True + True + True + image1 + + + + False + True + 0 + + + + + True + True + True + image2 + + + + False + True + 1 + + + + + False + True + 0 + + + + + True + True + + + True + True + liststore2 + + + + + + Blocked + + + + + UID + + + + + Login + + + + + Username + + + + + Primary group + + + + + Additional groups + + + + + Home directory + + + + + + + True + False + Users + + + False + + + + + True + True + liststore1 + + + + + + UID + + + + + + + + Group + + + + + + + + Group users + + + + + + + + 1 + + + + + True + False + Groups + + + 1 + False + + + + + True + True + 1 + + + + + + + True + False + True + + + True + False + Users and groups + + + + + + + + + diff --git a/ubl-settings-usergroups-user.glade b/ubl-settings-usergroups-user.glade index 8719198..a6c6d20 100644 --- a/ubl-settings-usergroups-user.glade +++ b/ubl-settings-usergroups-user.glade @@ -2,233 +2,1038 @@ + + + + 100 + 1 + 10 + + + 100 + 1 + 10 + + + 100 + 1 + 10 + + + 100 + 1 + 10 + + + True + False + com.ublinux.ubl-settings-usergroups.profile-symbolic + True False - emblem-ok-symbolic + com.ublinux.ubl-settings-usergroups.accept-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.zoom-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.edit-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.group-symbolic + + + True + False + com.ublinux.ubl-settings-usergroups.calendar-symbolic True False - process-stop-symbolic + com.ublinux.ubl-settings-usergroups.cancel-symbolic + 500 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 - - - - - Automatically - True - True - False - True - - - False - True - 1 - - - - - True - True - 1001 - number - - - True - True - 2 - - - - - False - True - 0 - - - - - True - False - 5 - - - True - False - User name: - 0 - - - False - True - 0 - - - - - True - True - username - - - True - True - 1 - - - - - False - True - 1 - + + + + False + True + 0 + + + + + True + True + never + in - + True False - 5 + 5 + 5 + 5 + 5 - + True False - Login: - 0 + vertical + 5 + + + True + False + 5 + + + True + False + UID: + 0 + + + False + True + 0 + + + + + Automatically + True + True + False + True + + + False + True + 2 + + + + + True + True + 1001 + number + + + True + True + 4 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Login: + 0 + + + False + True + 0 + + + + + True + True + com.ublinux.ubl-settings-usergroups.profile-symbolic + login + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Password: + 0 + + + False + True + 0 + + + + + True + False + 0 + + Default + No password required + Set a password + Encrypted password + + + + False + True + 1 + + + + + True + True + False + * + com.ublinux.ubl-settings-usergroups.key-symbolic + False + False + ****** + password + + + True + True + 2 + + + + + True + True + True + image3 + + + + False + True + 3 + + + + + False + True + 2 + + + + + True + False + 5 + + + True + False + User name: + 0 + + + False + True + 0 + + + + + True + True + username + + + True + True + 1 + + + + + False + True + 3 + + + + + True + False + 5 + + + True + False + Main group: + 0 + + + False + True + 0 + + + + + Login name + True + True + False + True + + + False + True + 1 + + + + + True + True + + + True + True + 2 + + + + + True + True + True + image1 + + + + False + True + 3 + + + + + False + True + 4 + + + + + True + False + 5 + + + True + False + Additional group: + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + True + True + True + image4 + + + + False + True + 2 + + + + + False + True + 7 + + + + + True + False + 0 + in + + + True + False + 5 + 5 + 5 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + Password has been changed: + + + False + True + 0 + + + + + True + True + + + False + True + 1 + + + + + True + False + expiration date: + + + False + True + 2 + + + + + True + True + + + False + True + 3 + + + + + True + True + True + image5 + + + + False + True + 4 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Password change interval: minimum + + + False + True + 0 + + + + + True + True + adjustment1 + + + False + True + 1 + + + + + True + False + days, maximum + + + False + True + 2 + + + + + True + True + adjustment2 + + + False + True + 3 + + + + + True + False + days + + + False + True + 4 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + Days until warning: + + + False + True + 0 + + + + + True + True + adjustment3 + + + False + True + 1 + + + + + False + True + 2 + + + + + True + False + 5 + + + True + False + Days without activity: + + + False + True + 0 + + + + + True + True + adjustment4 + + + False + True + 1 + + + + + False + True + 3 + + + + + True + False + 5 + + + Force change at next login + True + True + False + True + + + False + True + 0 + + + + + False + True + 4 + + + + + + + + + True + False + Password configuration + + + + + False + True + 8 + + + + + True + False + 0 + in + + + True + False + 5 + 5 + 5 + + + True + False + vertical + 5 + + + True + False + 5 + + + True + False + User shell: + + + False + True + 0 + + + + + True + False + + Default + + + + False + True + 1 + + + + + True + True + + + True + True + 2 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + Home directory: + + + False + True + 0 + + + + + True + False + + Default + + + + False + True + 1 + + + + + True + True + + + True + True + 2 + + + + + True + True + True + image2 + + + + False + True + 3 + + + + + False + True + 1 + + + + + True + False + 5 + + + Create system user + True + True + False + True + + + False + True + 0 + + + + + False + True + 2 + + + + + True + False + 5 + + + Create user with ununique (repeating) UID + True + True + False + True + + + False + True + 0 + + + + + False + True + 3 + + + + + True + False + 5 + + + Do not check login for compliance with character rules + True + True + False + True + + + False + True + 0 + + + + + False + True + 4 + + + + + + + + + True + False + Additional configuration + + + + + False + True + 9 + + + + + Sync with SAMBA user + True + True + False + True + + + False + True + 10 + + + + + Temporary deactivation + True + True + False + True + + + False + True + 11 + + + + + True + False + 5 + + + True + False + Extra options: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 1 + + + + + False + True + 13 + + - - False - True - 0 - - - - - True - True - login - - - True - True - 1 - - - False - True - 2 - + + + True + True + 1 + + + + + True + False + 5 + 5 + 5 True False 5 + True - - True - False - Password: - 0 - - - False - True - 0 - - - - - Default + + Cancel True True - False - True - - - False - True - 1 - - - - - True - True - False - * - False - False - ****** - password - - - True - True - 2 - - - - - False - True - 3 - - - - - True - False - 5 - - - True - False - Main group: - 0 + True + image7 + False @@ -237,69 +1042,19 @@ - - True - True - - - True - True - 1 - - - - - Additional groups + + Save True True True + image10 + False True - 2 - - - - - False - True - 4 - - - - - True - False - 5 - - - True - False - Password hash algorythm: - 0 - - - False - True - 0 - - - - - True - False - 0 - - sha256 - AIX md5 - md5 (apache variant) - md5 - - - - True - True 1 @@ -307,112 +1062,16 @@ 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 + end 0 - - - Save - True - True - True - image10 - - - - True - True - 1 - - False True end - 1 + 2 @@ -435,14 +1094,4 @@ - - - - - - - - - - diff --git a/ubl-settings-usergroups.glade b/ubl-settings-usergroups.glade index 1645544..c7b056e 100644 --- a/ubl-settings-usergroups.glade +++ b/ubl-settings-usergroups.glade @@ -25,391 +25,150 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - False - False - True - center - com.ublinux.ubl-settings-usergroups - dialog - True - ubl-settings-usergroups - 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>. - UBGroup - UBGroup - com.ublinux.ubl-settings-usergroups - True - gpl-2-0 - - - True - False - vertical - 2 - - - False - end - - - False - False - 1 - - - - - - - True - False - True - - - True - False - 5 - 5 - 5 - 5 - 2 - Users and groups - - - - - - - - - - True - False - center - - - True - False - 5 - 5 - 5 - 5 - 6 - 6 - 64 - com.ublinux.ubl-settings-usergroups - - - False - True - 0 - - - - - True - False - - - True - False - - - True - False - center - vertical - - - 255 - True - False - end - Users and groups - 0 - - - - - - - - True - True - 0 - - - - - 255 - True - False - start - System users and groups configuration - True - 0 - - - - - - - - True - True - 1 - - - - - False - True - 0 - - - - - True - True - 0 - - - - - True - True - 1 - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True False - value-increase-symbolic + com.ublinux.ubl-settings-usergroups.increase-symbolic - + True False - document-edit-symbolic + com.ublinux.ubl-settings-usergroups.group-symbolic - + + True + False + com.ublinux.ubl-settings-usergroups.profile-settings-symbolic + + True False - user-trash-symbolic + com.ublinux.ubl-settings-usergroups.settings-symbolic - + True False - document-edit-symbolic + com.ublinux.ubl-settings-usergroups.sync-symbolic - + True False - process-stop-symbolic + com.ublinux.ubl-settings-usergroups.edit-symbolic - + True False - emblem-ok-symbolic + com.ublinux.ubl-settings-usergroups.trash-symbolic - + + True False - False - 450 - dialog-question-symbolic + 5 + 5 + 5 + 5 + 5 + 5 + True + True + 5 True False - 5 - 5 - 5 - 5 vertical - 10 + 5 - + True - False - - - True - False - start - 20 - 20 - dialog-question-symbolic - 6 - - - False - True - 0 - - - - - True - False - vertical - - - True - False - start - 10 - 5 - Would you like to read documentation in the Web? - True - 0 - - - - - - - False - True - 0 - - - - - True - False - start - start - 10 - 10 - You will be redirected to documentation website where documentation is -translated and supported by community. - True - 0 - - - - False - True - 1 - - - - - Always redirect to online documentation - True - True - False - end - True - - - - False - True - end - 2 - - - - - - True - True - 1 - - + True + True + image12 - True + False True 0 - + True - False - 30 - True - - - Cancel - True - True - True - image8 - - - - True - True - 0 - - - - - Open documentation - True - True - True - image9 - - - - True - True - 1 - - + True + True + image11 + False @@ -417,792 +176,314 @@ translated and supported by community. 1 - - - - - True - False - True - - + + True - False - Users and groups - - - + True + True + image10 + + + False + True + 2 + + + + + True + True + True + image1 + + + + False + True + 3 + + + + + True + True + True + image2 + + + + False + True + 4 + + + + + True + True + True + image3 + + + + False + True + 5 + + + + + True + True + True + image13 + + + + False + True + 6 + + + False + True + 0 + - - - True - False - False - - - True - False - Load global configuration - - - - - - True - False - Load local configuration - - - - - - True - False - False - False - - - True - False - Documentation - True - - - - - - True - False - About - - - - - - True - False - False - - - True - False - Save configuration - - - - - - True - False - Save to global configuration - - - - - - True - False - Save to local configuration - - - - - - 800 - 600 - False - 800 - 600 - com.ublinux.ubl-settings-usergroups - + True - False - vertical + True True False - vertical - - - True - False - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - 25 - - - False - True - 0 - - - - - True - False - start - 5 - 5 - 5 - 5 - 6 - 6 - True - - - - - - - False - True - 1 - - - - - False - True - 0 - - + 5 + 5 + 5 + 5 + 5 - + True - False - vertical + True + external - - 81 + True - False + True + UsersList + 0 + + + - - True - False - start + + Block - - -1 - - - - False - True - 0 - - - - - False - True - 1 - - - - - True - False - 5 - 5 - 5 - 5 - 5 - 5 - True - True - vertical - 5 - - - True - False - vertical - 5 - - True - False - 5 + + UID - - True - False - 5 - Default user groups: - 0 - - - False - True - 0 - - - - - True - True - - - True - True - 1 - - - - - True - True - True - image4 - - - False - True - 2 - + + + 0 + - - False - True - 0 - - - True - False - 5 - - - True - False - 5 - Default user name (if there's no another): - 0 - - - False - True - 0 - - + + Login - - True - True - - - True - True - 1 - + + + 5 + - - False - True - 1 - - - User with ID 1000 is administrator - True - True - False - True + + User name + + + + 4 + + - - False - True - 2 - - - True - False - 5 - - - True - False - 5 - Default user password: - 0 - - - False - True - 0 - - + + Main group - - True - True - 30 - False - - password - - - False - True - 1 - - - - - True - True - end - 30 - False - - password - - - False - True - end - 2 - - - - - True - False - Root user password: - - - False - True - end - 3 - + - - False - True - 3 - - - True - False - 5 - - - True - False - 5 - Password hash algorythm: - 0 - - - False - True - 0 - - + + Additional groups - - True - False - 0 - - sha256 - AIX md5 - md5 (apache variant) - md5 - - - - True - True - 1 - + - - False - True - 4 - - - - False - True - 0 - - - - - True - False - 5 - - True - True - external - in + + Additional parameters - - True - True - UserList - - - - - - UID - - - - 0 - - - - - - - Login - - - - 2 - - - - - - - Password - - - - 3 - - - - - - - User name - - - - 5 - - - - - + - - True - True - 0 - - - True - False - vertical - 5 - - - True - True - True - image1 - - - - False - True - 0 - - - - - True - True - True - image2 - - - - False - True - 1 - - - - - True - True - True - image3 - - - - False - True - 2 - - + + Password status - - False - True - 1 - - - True - True - 1 - - False + True True - 2 + 1 - - True - True - 0 - - - - - - True - False - True - - + + True False - 5 - 5 - 5 - 5 - 2 - Users and groups - - - + Users + + False + - + True False - 5 - 5 5 5 - 6 - 6 - 32 - com.ublinux.ubl-settings-usergroups - - - - - True - False + 5 + 5 + 5 - + True True - False - True - menu3 + external - + True - False + True + UsersList + 0 + + + + + + GID + + + + 0 + + + + - - True - False - Save + + Group name + + + + 2 + + - - False - True - 0 - - - True - False - pan-down-symbolic + + Group users + + + + 3 + + + + + + + Additional parameters + + + + 5 + + + + + + + Password status + + + - - False - True - 1 - - False + True True 0 - - - True - True - True - False - True - True - menu2 - none - - - - - - - False - True - 1 - - - end 1 - - + + True False - - - True - True - False - True - menu1 - - - True - False - - - True - False - Load - - - False - True - 0 - - - - - True - False - pan-down-symbolic - - - False - True - 1 - - - - - - - False - True - 0 - - + Groups - 2 + 1 + False - + + True + True + 1 + - - - - - - - - diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index 559f905..7b13235 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -74,177 +74,181 @@ msgid "System users and groups configuration" msgstr "" #: source/ubl-strings.h:7 -msgid "Operation succeeded" +msgid "Default user groups:" msgstr "" #: source/ubl-strings.h:8 -msgid "" -"Warning! Application was launched without root - root-dependent actions are " -"locked" +msgid "Default user name (if there's no another):" +msgstr "" + +#: source/ubl-strings.h:9 +msgid "User with ID 1000 is administrator" msgstr "" #: source/ubl-strings.h:10 -msgid "About" +msgid "Default user password:" msgstr "" #: source/ubl-strings.h:11 -msgid "Documentation" +msgid "Root user password:" msgstr "" -#: source/ubl-strings.h:13 -msgid "Save to local configuration" +#: source/ubl-strings.h:12 source/ubl-strings.h:26 +msgid "Password hash algorythm:" msgstr "" #: source/ubl-strings.h:14 -msgid "Save to global configuration" +msgid "UID" msgstr "" #: source/ubl-strings.h:15 -msgid "Save configuration" +msgid "Login" msgstr "" #: source/ubl-strings.h:16 -msgid "Save" +msgid "Password" msgstr "" -#: source/ubl-strings.h:18 -msgid "Load local configuration" +#: source/ubl-strings.h:17 +msgid "User name" msgstr "" #: source/ubl-strings.h:19 -msgid "Load global configuration" +msgid "UID:" msgstr "" #: source/ubl-strings.h:20 -msgid "Load" +msgid "User name:" +msgstr "" + +#: source/ubl-strings.h:21 +msgid "Login:" msgstr "" #: source/ubl-strings.h:22 -msgid "Cancel" +msgid "Password:" msgstr "" -#: source/ubl-strings.h:24 -msgid "Would you like to read documentation in the Web?" +#: source/ubl-strings.h:23 +msgid "Default" msgstr "" -#: source/ubl-strings.h:25 -msgid "" -"You will be redirected to documentation website where documentation is\n" -"translated and supported by community." +#: source/ubl-strings.h:24 +msgid "Main group:" msgstr "" -#: source/ubl-strings.h:26 -msgid "Always redirect to online documentation" +#: source/ubl-strings.h:25 +msgid "Additional groups" msgstr "" #: source/ubl-strings.h:27 -msgid "Open documentation" +msgid "Sync with SAMBA user" msgstr "" #: source/ubl-strings.h:28 -msgid "Project Home Page" +msgid "Extra options:" msgstr "" #: source/ubl-strings.h:29 -msgid "Nothing were chosen" +msgid "Cancel" +msgstr "" + +#: source/ubl-strings.h:30 +msgid "Ok" msgstr "" #: source/ubl-strings.h:32 -msgid "Global configuration loading succseeded." +msgid "Block" msgstr "" #: source/ubl-strings.h:33 -msgid "Local configuration loading succseeded." +msgid "Main group" msgstr "" #: source/ubl-strings.h:34 -msgid "Config loading failed" +msgid "Additional parameters" +msgstr "" + +#: source/ubl-strings.h:35 +msgid "Password status" msgstr "" #: source/ubl-strings.h:36 -msgid "Local and global configuration saving succseeded." +msgid "Users" msgstr "" #: source/ubl-strings.h:37 -msgid "Global configuration saving succseeded." +msgid "GID" msgstr "" #: source/ubl-strings.h:38 -msgid "Local configuration saving succseeded." -msgstr "" - -#: source/ubl-strings.h:40 -msgid "Default user groups:" +msgid "Group name" msgstr "" -#: source/ubl-strings.h:41 -msgid "Default user name (if there's no another):" +#: source/ubl-strings.h:39 +msgid "Group users" msgstr "" -#: source/ubl-strings.h:42 -msgid "User with ID 1000 is administrator" +#: source/ubl-strings.h:40 +msgid "Groups" msgstr "" #: source/ubl-strings.h:43 -msgid "Default user password:" +msgid "Set a 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:" +msgid "Endrypted password" msgstr "" #: source/ubl-strings.h:47 -msgid "UID" +msgid "No password required" msgstr "" -#: source/ubl-strings.h:48 -msgid "Login" +#: source/ubl-strings.h:58 +msgid "Accept" msgstr "" -#: source/ubl-strings.h:49 -msgid "Password" +#: source/ubl-strings.h:61 +msgid "Automatically" msgstr "" -#: source/ubl-strings.h:50 -msgid "User name" +#: source/ubl-strings.h:62 +msgid "login" msgstr "" -#: source/ubl-strings.h:52 -msgid "UID:" +#: source/ubl-strings.h:63 +msgid "Create group with ununique GID" msgstr "" -#: source/ubl-strings.h:53 -msgid "User name:" +#: source/ubl-strings.h:64 +msgid "Create system group" msgstr "" -#: source/ubl-strings.h:54 -msgid "Login:" +#: source/ubl-strings.h:65 +msgid "Encrypted password" msgstr "" -#: source/ubl-strings.h:55 -msgid "Password:" +#: source/ubl-strings.h:66 +msgid "Additional configuration" msgstr "" -#: source/ubl-strings.h:56 -msgid "Default" +#: source/ubl-strings.h:82 +msgid "Blocked" msgstr "" -#: source/ubl-strings.h:57 -msgid "Main group:" +#: source/ubl-strings.h:83 +msgid "Username" msgstr "" -#: source/ubl-strings.h:58 -msgid "Additional groups" +#: source/ubl-strings.h:84 +msgid "Primary group" msgstr "" -#: source/ubl-strings.h:60 -msgid "Sync with SAMBA user" +#: source/ubl-strings.h:85 +msgid "Home directory" msgstr "" -#: source/ubl-strings.h:61 -msgid "Extra options:" +#: source/ubl-strings.h:86 source/ubl-strings.h:88 source/ubl-strings.h:89 +msgid "Group" msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index 609c4ff..9bae460 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -77,181 +77,182 @@ msgstr "" "конфигурационный файл)" #: source/ubl-strings.h:7 -msgid "Operation succeeded" -msgstr "Операция завершена" +msgid "Default user groups:" +msgstr "Группы пользователей по умлочанию:" #: source/ubl-strings.h:8 -msgid "" -"Warning! Application was launched without root - root-dependent actions are " -"locked" -msgstr "" -"Внимание! Приложение было запущено без прав суперпользователя - действия, " -"требующие их наличия заблокированы" +msgid "Default user name (if there's no another):" +msgstr "Имя пользователя по умолчанию (если нет других):" + +#: source/ubl-strings.h:9 +msgid "User with ID 1000 is administrator" +msgstr "Пользователь с ID 1000 является администратором" #: source/ubl-strings.h:10 -msgid "About" -msgstr "О программе" +msgid "Default user password:" +msgstr "Пароль для пользователя по умолчанию" #: source/ubl-strings.h:11 -msgid "Documentation" -msgstr "Справка" +msgid "Root user password:" +msgstr "Пароль пользователя root" -#: source/ubl-strings.h:13 -msgid "Save to local configuration" -msgstr "Сохранить в локальную конфигурацию" +#: source/ubl-strings.h:12 source/ubl-strings.h:26 +msgid "Password hash algorythm:" +msgstr "Алгоритм хэширования пароля" #: source/ubl-strings.h:14 -msgid "Save to global configuration" -msgstr "Сохранить в глобальную конфигурацию" +msgid "UID" +msgstr "UID" #: source/ubl-strings.h:15 -msgid "Save configuration" -msgstr "Сохранить конфигурацию" +msgid "Login" +msgstr "Логин" #: source/ubl-strings.h:16 -msgid "Save" -msgstr "Сохранить" +msgid "Password" +msgstr "Пароль" -#: source/ubl-strings.h:18 -msgid "Load local configuration" -msgstr "Загрузить локальную конфигуруцию" +#: source/ubl-strings.h:17 +msgid "User name" +msgstr "Имя пользователя" #: source/ubl-strings.h:19 -msgid "Load global configuration" -msgstr "Загрузить глобальную конфигурацию" +msgid "UID:" +msgstr "UID:" #: source/ubl-strings.h:20 -msgid "Load" -msgstr "Загрузить" +msgid "User name:" +msgstr "Имя пользователя:" + +#: source/ubl-strings.h:21 +msgid "Login:" +msgstr "Логин:" #: source/ubl-strings.h:22 -msgid "Cancel" -msgstr "Отмена" +msgid "Password:" +msgstr "Пароль:" + +#: source/ubl-strings.h:23 +msgid "Default" +msgstr "По умолчанию" #: source/ubl-strings.h:24 -msgid "Would you like to read documentation in the Web?" -msgstr "Вы хотите прочитать справку в Сети?" +msgid "Main group:" +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 "Всегда перенаправлять" +msgid "Additional groups" +msgstr "Дополнительные группы" #: source/ubl-strings.h:27 -msgid "Open documentation" -msgstr "Прочитать справку" +msgid "Sync with SAMBA user" +msgstr "Синхронизировать с пользователем SAMBA" #: source/ubl-strings.h:28 -msgid "Project Home Page" -msgstr "Домашняя страница проекта" +msgid "Extra options:" +msgstr "Дополнительный опции:" #: source/ubl-strings.h:29 -msgid "Nothing were chosen" -msgstr "Ничего не было выбрано" +msgid "Cancel" +msgstr "Отменить" + +#: source/ubl-strings.h:30 +msgid "Ok" +msgstr "Ок" #: source/ubl-strings.h:32 -msgid "Global configuration loading succseeded." -msgstr "Успешно загружена глобальная конфигурация" +msgid "Block" +msgstr "Блок" #: source/ubl-strings.h:33 -msgid "Local configuration loading succseeded." -msgstr "Успешно загружена локальная конфигурация" +msgid "Main group" +msgstr "Основная группа" #: source/ubl-strings.h:34 -msgid "Config loading failed" -msgstr "Ошибка загрузки конфигурации" +msgid "Additional parameters" +msgstr "Дополнительные группы" + +#: source/ubl-strings.h:35 +msgid "Password status" +msgstr "Статус пароля" #: source/ubl-strings.h:36 -msgid "Local and global configuration saving succseeded." -msgstr "Успешно записаны локальная и глобальная конфигурация" +msgid "Users" +msgstr "Пользователи" #: source/ubl-strings.h:37 -msgid "Global configuration saving succseeded." -msgstr "Успешно записана глобальная конфигурация" +msgid "GID" +msgstr "GID" #: source/ubl-strings.h:38 -msgid "Local configuration saving succseeded." -msgstr "Успешно записана локальная конфигурация" +#, fuzzy +msgid "Group name" +msgstr "Имя группы" -#: source/ubl-strings.h:40 -msgid "Default user groups:" -msgstr "Группы пользователей по умлочанию:" +#: source/ubl-strings.h:39 +msgid "Group users" +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:40 +msgid "Groups" +msgstr "Группы" #: source/ubl-strings.h:43 -msgid "Default user password:" -msgstr "Пароль для пользователя по умолчанию" +msgid "Set a 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 "Алгоритм хэширования пароля" +msgid "Endrypted password" +msgstr "Зашифрованный пароль" #: source/ubl-strings.h:47 -msgid "UID" -msgstr "UID" +msgid "No password required" +msgstr "Пароль не требуется" -#: source/ubl-strings.h:48 -msgid "Login" -msgstr "Логин" +#: source/ubl-strings.h:58 +msgid "Accept" +msgstr "Принять" -#: source/ubl-strings.h:49 -msgid "Password" -msgstr "Пароль" +#: source/ubl-strings.h:61 +msgid "Automatically" +msgstr "Автоматически" -#: source/ubl-strings.h:50 -msgid "User name" -msgstr "Имя пользователя" +#: source/ubl-strings.h:62 +msgid "login" +msgstr "логин" -#: source/ubl-strings.h:52 -msgid "UID:" -msgstr "UID:" +#: source/ubl-strings.h:63 +msgid "Create group with ununique GID" +msgstr "Создать группу с повторяющимися (не уникальными) GID" -#: source/ubl-strings.h:53 -msgid "User name:" -msgstr "Имя пользователя:" +#: source/ubl-strings.h:64 +msgid "Create system group" +msgstr "Создать системную группу" -#: source/ubl-strings.h:54 -msgid "Login:" -msgstr "Логин:" +#: source/ubl-strings.h:65 +msgid "Encrypted password" +msgstr "Зашифрованный пароль" -#: source/ubl-strings.h:55 -msgid "Password:" -msgstr "Пароль:" +#: source/ubl-strings.h:66 +msgid "Additional configuration" +msgstr "Загрузить локальную конфигуруцию" -#: source/ubl-strings.h:56 -msgid "Default" -msgstr "По умолчанию" +#: source/ubl-strings.h:82 +msgid "Blocked" +msgstr "Заблокировано" -#: source/ubl-strings.h:57 -msgid "Main group:" -msgstr "Основная группа:" +#: source/ubl-strings.h:83 +msgid "Username" +msgstr "Имя пользователя" -#: source/ubl-strings.h:58 -msgid "Additional groups" -msgstr "Дополнительные группы" +#: source/ubl-strings.h:84 +msgid "Primary group" +msgstr "Основная группа" -#: source/ubl-strings.h:60 -msgid "Sync with SAMBA user" -msgstr "Синхронизировать с пользователем SAMBA" +#: source/ubl-strings.h:85 +msgid "Home directory" +msgstr "Домашний каталог" -#: source/ubl-strings.h:61 -msgid "Extra options:" -msgstr "Дополнительный опции:" +#: source/ubl-strings.h:86 source/ubl-strings.h:88 source/ubl-strings.h:89 +msgid "Group" +msgstr "Группа"