diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..12d63ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +.vscode/ +config.conf +ubconfig-main-back.conf +gtk-dark.css +msgformat.py +calendarApp.glade +calendarApp.glade~ +ubl-settings-manager.glade~ +*ubl-settings-manager.glade# +ubl-settings-manager +**base.mo +home/ +css/ +.config/ +images/ +locale/ +ui/ +ubl-settings-manager_ru.pos \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..16ade97 --- /dev/null +++ b/Makefile @@ -0,0 +1,154 @@ +#!/usr/bin/make -f + +#SHELL := /bin/bash +MAKEFILE_FILEPATH := $(abspath $(lastword $(MAKEFILE_LIST))) +MAKEFILE_DIR := $(notdir $(patsubst %/,%,$(dir $(MAKEFILE_FILEPATH)))) +MAKEFILE_PATH := $(dir $(MAKEFILE_FILEPATH)) + +CMAKE_COMMAND = cmake +#CMAKE_SOURCE_DIR = $(MAKEFILE_PATH)source +#CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile +CMAKE_SOURCE_DIR = ./source +CMAKE_BUILD_DIR = ./compile +DEPENDS = cmake +PKGNAME = $(MAKEFILE_DIR) +#PKGNAME = ubl-settings-manager + +default_target: all + +all: init build + +init: + @echo "Initialize ..."; \ + version="$$(cat VERSION.md)"; \ + version=$${version:8}; \ + search="s/string version_application.*"; \ + replace="string version_application = \"$${version}\";"; \ + sed -i -e "$$search/$$replace/gi" source/ubl-settings-manager.h; \ + echo "-- Build path: ${CMAKE_BUILD_DIR}" + +depend: + @echo "Check depends ..."; \ + if [ ! -f /bin/cmake ]; then \ + echo "-- Depend 'cmake' not found !"; \ + exit 1; \ + fi; \ + echo "Check depends: OK" +# $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 + +debug: + @echo "Debug ..." + if [ ! -d ${CMAKE_BUILD_DIR} ]; then \ + cmake -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="/usr"; \ + fi; \ + echo "Debug: OK" + +prepare: + @echo "Prepare ..."; \ + if [ ! -d ${CMAKE_BUILD_DIR} ]; then \ + cmake -S${CMAKE_SOURCE_DIR} -B${CMAKE_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr"; \ + fi; \ + echo "Prepare: OK" + +check: + @echo "Check ..."; \ + if [ -f ${CMAKE_BUILD_DIR}/${PKGNAME} ]; then \ + echo "Check: OK"; \ + else \ + echo "Check: ${CMAKE_BUILD_DIR}/${PKGNAME} not found !"; \ + exit 1; \ + fi + +build: depend prepare + @echo "Build ..."; \ + make --directory=${CMAKE_BUILD_DIR}; \ + echo "Build: OK" + +uninstall: + @echo "Uninstall ..." + @for SIZE in 16x16 32x32 48x48 scalable; do \ + $(RM) "/usr/share/icons/hicolor/$${SIZE}/apps/${PKGNAME}.svg"; \ + $(RM) "/usr/share/"${pkgname}"/images/${PKGNAME}.png"; \ + done + @for FILE_SVG in $(wildcard *.svg); do \ + for SIZE in 16x16 32x32 48x48 scalable; do \ + $(RM) "/usr/share/icons/hicolor/$${SIZE}/status/$${FILE_SVG%.*}".{svg,png,jpg}; \ + done; \ + done + @for FILE_PO in $(wildcard *.po); do \ + LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ + FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ + PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + $(RM) "/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + done + @$(RM) "/usr/bin/${PKGNAME}" + @$(RM) "/usr/share/applications/${PKGNAME}.desktop" + @$(RM) "/usr/share/icons/hicolor/scalable/apps/ru.ublinux.${PKGNAME}.svg" + @$(RM) "/usr/share/${PKGNAME}/ui/ublinux-logo.svg" + @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}.glade" + @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" + @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}-banner.png" + @$(RM) -d "/usr/share/${PKGNAME}/css" + @$(RM) -d "/usr/share/${PKGNAME}/ui" + @$(RM) -d "/usr/share/${PKGNAME}" + @$(RM) "/etc/xdg/${PKGNAME}/${PKGNAME}.conf" + @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null + @update-desktop-database --quiet 2>/dev/null + @touch /usr/share/applications + @echo "Uninstall: OK" + +install: check uninstall + @echo "Install ..." + @for FILE_PO in $(wildcard *.po); do \ + LANG=$${FILE_PO##*_};LANG=$${LANG%.*}; \ + install -dm755 /usr/share/locale/$${LANG}/LC_MESSAGES; \ + FILE_MO=$${FILE_PO##*/}; FILE_MO="$${FILE_MO%_*.po}.mo"; \ + PATH_FILE_MO="/usr/share/locale/$${LANG}/LC_MESSAGES/$${FILE_MO}"; \ + echo $${FILE_PO}; \ + msgfmt "$${FILE_PO}" -v -f -o "$${PATH_FILE_MO}"; \ + done + @for SIZE in 16 32 48; do \ + install -dm755 /usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps; \ + rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data ru.ublinux.${PKGNAME}.svg -o "/usr/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/ru.ublinux.${PKGNAME}.svg"; \ + done + @install -dm755 /usr/share/icons/hicolor/scalable/apps + @install -Dm644 -t /usr/share/icons/hicolor/scalable/apps/ ru.ublinux.${PKGNAME}.svg + @install -Dm755 -t /usr/bin/ ${CMAKE_BUILD_DIR}/${PKGNAME} + @install -Dm644 -t /usr/share/applications/ ${PKGNAME}.desktop + @install -Dm755 /usr/share/${PKGNAME}/ -d ui + @install -Dm755 /usr/share/${PKGNAME}/ -d css + @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.glade + @install -Dm644 -t /usr/share/${PKGNAME}/css/ ${PKGNAME}.css + @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ublinux-logo.svg + @install -Dm766 -t /etc/xdg/${PKGNAME}/ ${PKGNAME}.conf + @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}-banner.png + @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null + @update-desktop-database --quiet 2>/dev/null + @touch /usr/share/applications + @echo "Install: OK" + +clean: + @echo "Clean ..." + @$(RM) -rd ${CMAKE_BUILD_DIR} + @if [ -d ${CMAKE_BUILD_DIR} ]; then \ + echo "Clean: error, compile directory exist ${CMAKE_BUILD_DIR}"; \ + else \ + echo "Clean: OK"; \ + fi; \ + version="$$(cat VERSION.md)"; \ + version=$${version:8}; \ + search="s/string version_application.*"; \ + echo $$search; \ + replace="string version_application = ;"; \ + sed -i -e "$$search/$$replace/gi" source/ubl-settings-manager.h; \ + +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... init" + @echo "... debug" + @echo "... prepare" + @echo "... compile" + @echo "... install" + @echo "... uninstall" + @echo "... clean" diff --git a/VERSION.md b/VERSION.md new file mode 100644 index 0000000..31c5941 --- /dev/null +++ b/VERSION.md @@ -0,0 +1 @@ +VERSION 1.2 diff --git a/ru.ublinux.ubl-settings-manager.svg b/ru.ublinux.ubl-settings-manager.svg new file mode 100644 index 0000000..f636c26 --- /dev/null +++ b/ru.ublinux.ubl-settings-manager.svg @@ -0,0 +1,4957 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt new file mode 100644 index 0000000..6279e9e --- /dev/null +++ b/source/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.7) +project(ubl-settings-manager) + +find_package(PkgConfig REQUIRED) + +pkg_check_modules(GTK REQUIRED gtk+-3.0) +include_directories(${GTK_INCLUDE_DIRS}) +link_directories(${GTK_LIBRARY_DIRS}) +add_definitions(${GTK_CFLAGS_OTHER}) + +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm") + +set(SOURCE_FILES + ubl-settings-manager.c + ubl-settings-manager.h) + +set(LIBRARIES + ${GTK_LIBRARIES} + pthread) + + +add_executable(ubl-settings-manager ${SOURCE_FILES}) +target_link_libraries(ubl-settings-manager ${LIBRARIES}) +install(TARGETS ubl-settings-manager DESTINATION bin) \ No newline at end of file diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c new file mode 100644 index 0000000..c7a18d3 --- /dev/null +++ b/source/ubl-settings-manager.c @@ -0,0 +1,1820 @@ +#ifndef UBL_SETTINGS_MANAGER_MAIN +#define UBL_SETTINGS_MANAGER_MAIN +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include "ubl-settings-manager.h" + +#define _(String) gettext(String) + +char **sectionremoval=NULL; +int removalsize=0; +char *local; +config main_config; + +char *cats[2]={"XFCE","GTK"}; +char *ubcatsPersonal[2]={"X-UBL-SettingsManager","X-UBL-PersonalSettings"}; +char *ubcatsSystem[2]={"X-UBL-SettingsManager","X-UBL-SystemSettings"}; +char *ubcatsHardware[2]={"X-UBL-SettingsManager","X-UBL-HardwareSettings"}; +char *ubcatsMisc[1]={NULL}; +int gnld=0; +int stld=0; +int cmld=0; + + + +void on_plug_added(GtkSocket* self, actionWidgets *builder){ + gtk_widget_show(builder->socketbutton); + gtk_widget_show(builder->ThirdSocket); + gtk_widget_set_vexpand(builder->HideWhileLaunch,0); + gtk_widget_hide(builder->HideWhileLaunch); + gtk_widget_set_vexpand(GTK_WIDGET(builder->socketplace),1); + gtk_widget_set_vexpand(GTK_WIDGET(self),1); + gtk_widget_show(builder->socketplace); + gtk_widget_hide(builder->appSettings); + if (builder->ButtonBackToMain!=NULL) gtk_widget_show(builder->ButtonBackToMain); + gtk_widget_show(GTK_WIDGET(self)); + gtk_widget_show(builder->socketbuttonplace); + gtk_widget_show(builder->ThirdSocketPlace); + gtk_widget_show(builder->socketbutton); + gtk_widget_show(builder->ThirdSocket); +} + +void on_plug_removed(GtkSocket* self, actionWidgets *widgets){ + gtk_widget_show(widgets->socketbuttonplace); + gtk_widget_show(widgets->appSettings); + gtk_widget_show(widgets->HideWhileLaunch); + gtk_widget_set_vexpand(widgets->socketplace,0); + gtk_widget_set_vexpand(widgets->HideWhileLaunch,1); + if(widgets->socketbutton) + gtk_widget_destroy(widgets->socketbutton); + if(widgets->ThirdSocket) + gtk_widget_destroy(widgets->ThirdSocket); +} + +void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ + GtkTreeIter iter; + char *name; + gtk_tree_model_get_iter(gtk_icon_view_get_model(self),&iter,path); + gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,0,&name,-1); + + apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); + if (!tempapp){}else{ + char arg[100]; + memset(arg,0,100); + sprintf(arg,"--socket-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))); + + if (tempapp[0].Type==1){ + if (tempapp->Pluggable==1) + if (tempapp->DualPluggable==1){ + char *dualarg=malloc(strlen("--socket-id= --socket-ext-id= --socket-trd-id=")+30); + sprintf(dualarg,"--socket-id=%d --socket-ext-id=%d --socket-trd-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton)),gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket))); + launch_app_with_arguments(tempapp[0].Exec,dualarg); + } else + launch_app_with_arguments(tempapp[0].Exec,arg); + else launch_app(tempapp[0].Exec); + } + } +}; + +void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ + GtkTreeIter iter; + char *name; + if (!applist->socket){}else{ + gtk_widget_destroy(applist->socket); + } + applist->socket=create_socket(applist); + + gtk_tree_model_get_iter(gtk_icon_view_get_model(self),&iter,path); + gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,0,&name,-1); + + apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); + char arg[100]; + memset(arg,0,100); + sprintf(arg,"--socket-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket))); + + if (tempapp[0].Type==1){ + if (tempapp->Pluggable==1){ + + if (tempapp->DualPluggable==1){ + char *dualarg=malloc(strlen("--socket-id= --socket-ext-id= --socket-trd-id=")+30); + sprintf(dualarg,"--socket-id=%d --socket-ext-id=%d --socket-trd-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton)),gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket))); + if (launch_app_with_arguments(tempapp[0].Exec,dualarg)==32512) + gtk_widget_show(applist->infoWarningWindow); + } + else{ + launch_app_with_arguments(tempapp[0].Exec,arg); + gtk_widget_destroy(applist->socketbutton); + } + } + else { + launch_app(tempapp[0].Exec); + gtk_widget_destroy(applist->socketbutton); + } + } +} + +void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets){ + if (gtk_icon_view_get_selected_items(IV)>0){ + dictionary *next=widgets->ICSys->first; + for (dictionary *dct=next;dct!=NULL;dct=dct->next){ + IVGraphicals *IVG=(IVGraphicals*)dct->data; + if (GTK_ICON_VIEW(IVG->IV)!=GTK_ICON_VIEW(IV)) + if (gtk_icon_view_get_selected_items(GTK_ICON_VIEW(IVG->IV))>0) + gtk_icon_view_unselect_all(GTK_ICON_VIEW(IVG->IV)); + } + } +}; + +void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder){ + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,"AlwaysOpenHelpCheckbox")))) + { + system("xdg-open http://ublinux.com"); + } else + { + GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); + gtk_widget_show(window); + }; +}; + +void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb){ + GtkWidget *window=GTK_WIDGET(gtk_builder_get_object(sctb->builder,"HideWhileLaunch")); + GtkWidget *socketplace=GTK_WIDGET(gtk_builder_get_object(sctb->builder,"socketplace")); + gtk_widget_destroy(sctb->socket); + sctb->socket=GTK_WIDGET(create_socket(sctb)); + GtkWidget *backbutton=sctb->ButtonBackToMain; + gtk_widget_hide(backbutton); +}; + +void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder){ + GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); + gtk_widget_hide(window); +}; + +void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder){ + system("xdg-open http://ublinux.com"); + GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); + gtk_widget_hide(window); +}; + +int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ + if (main_config.WindowTheme==0) + main_config.curThemeName="Main"; + else if (main_config.WindowTheme==1) + main_config.curThemeName="Gnome"; + dictionary *widgetsD=yon_dictionary_find(widgetsDs,main_config.curThemeName); + actionWidgets *widgets=(actionWidgets*)widgetsD->data; + int theme=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); + gtk_window_get_position(GTK_WINDOW(widgets->window),&main_config.windowPosX,&main_config.windowPosY); + gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight); + if (theme==0) + main_config.curThemeName="Main"; + else if (theme==1) + main_config.curThemeName="Gnome"; + if (main_config.WindowTheme!=theme){ + main_config.WindowTheme=theme; + GtkWidget *loaderWindow=GTK_WIDGET(gtk_builder_get_object(widgets->builder,"LoaderWindow")); + gtk_window_resize(GTK_WINDOW(loaderWindow),main_config.windowWidth,main_config.windowHeight); + gtk_window_move(GTK_WINDOW(loaderWindow),main_config.windowPosX,main_config.windowPosY); + gtk_widget_show(loaderWindow); + yon_switch_theme(widgetsDs,yon_dictionary_find(&widgetsD,main_config.curThemeName)); + if (widgets!=(actionWidgets*)widgetsD->data) widgets=(actionWidgets*)widgetsD->data; + gtk_widget_hide(loaderWindow); + gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); + } + GKeyFile *gfile=g_key_file_new(); + + int sz=1,szm=1; + if (main_config.Gnomeiconsize==64) sz=4; + else if (main_config.Gnomeiconsize==48) sz=3; + else if (main_config.Gnomeiconsize==32) sz=2; + else if (main_config.Gnomeiconsize==24) sz=1; + if (main_config.Mainiconsize==64) szm=4; + else if (main_config.Mainiconsize==48) szm=3; + else if (main_config.Mainiconsize==32) szm=2; + else if (main_config.Mainiconsize==24) szm=1; + char *fromint=malloc(5); + memset(fromint,0,5); + GError *err=NULL; + char *login=getlogin(); + if (geteuid()==0){ + login=main_config.lastUser; + } else { + main_config.lastUser=login; + } + char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); + sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); + g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); + if (err){ + struct stat st = {0}; + char *ptdir=malloc(36+strlen(getlogin())); + sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); + if (stat(ptdir, &st) == -1) { + mkdir(ptdir, 0777); + } + FILE *fp; + fp=fopen(pth,"w"); + fclose(fp); + } + g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); + if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){ + sprintf(fromint,"%d",main_config.windowPosX); + g_key_file_set_string(gfile,"window","WindowPosX",fromint); + sprintf(fromint,"%d",main_config.windowPosY); + g_key_file_set_string(gfile,"window","WindowPosY",fromint); + sprintf(fromint,"%d",main_config.windowWidth); + g_key_file_set_string(gfile,"window","WindowWidth",fromint); + sprintf(fromint,"%d",main_config.windowHeight); + g_key_file_set_string(gfile,"window","WindowHeight",fromint); + } + sprintf(fromint,"%d",main_config.WindowTheme); + g_key_file_set_string(gfile,"window","WindowTheme",fromint); + sprintf(fromint,"%d",sz); + g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); + sprintf(fromint,"%d",szm); + g_key_file_set_string(gfile,"window","MainIconSize",fromint); + sprintf(fromint,"%d",main_config.iconSegmentSize); + g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); + g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); + g_key_file_set_string(gfile,"window","MainLabelSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); + g_key_file_set_string(gfile,"window","LabelDensity",fromint); + g_key_file_set_string(gfile,"window","User",login); + + g_key_file_remove_group(gfile, "sections",NULL); + for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){ + IVGraphicals *IV=(IVGraphicals*)dict->data; + g_key_file_set_string(gfile,"sections",IV->sectionName,IV->categories); + if (main_config.changed==1){ + load_apps_with_clear(IV,widgets->applist,widgets->appssize); + } + } + main_config.changed=0; + g_key_file_save_to_file(gfile,pth,NULL); + gtk_widget_hide(widgets->SettingsWindow); +}; + +void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets){ + int position=gtk_paned_get_position(GTK_PANED(widgets->GnomePaned)); + if (position<200) {position=200; gtk_paned_set_position(GTK_PANED(widgets->GnomePaned),200);} + main_config.iconSegmentSize=position; + double pos=((double)position-20); + if (pos<70) pos=70; + for (dictionary *dict=widgets->ICSys;dict!=NULL;dict=dict->next){ + IVGraphicals *IV=(IVGraphicals*)dict->data; + gtk_icon_view_set_item_width(GTK_ICON_VIEW(IV->IV),pos); + } + + +} + +int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){ + gtk_window_set_title(GTK_WINDOW(widgets->SettingsWindow),"UBLinux Settings Manager"); + gtk_widget_set_size_request(widgets->SettingsWindow,400,250); + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + gtk_window_set_icon(GTK_WINDOW(widgets->SettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_widget_show_all(widgets->SettingsWindow); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),main_config.WindowTheme); + int sz=1; + if (*main_config.currentThemeIconSize==64) sz=4; + if (*main_config.currentThemeIconSize==48) sz=3; + if (*main_config.currentThemeIconSize==32) sz=2; + if (*main_config.currentThemeIconSize==24) sz=1; + gtk_range_set_value(GTK_RANGE(widgets->settingsSizeSlider),sz); + char *tmp=malloc(6); + sprintf(tmp,"%dx%d\0",*main_config.currentThemeIconSize,*main_config.currentThemeIconSize); + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),tmp); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + + gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); +}; + +int on_settings_icon_size_changed(GtkWidget* self, actionWidgets *widgets){ + int val=(int)gtk_range_get_value(GTK_RANGE(self)); + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + if ((int)val==1||(int)val==0){ + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); + if (*main_config.currentThemeIconSize!=24) + main_config.changed=1; + *main_config.currentThemeIconSize=24; + } + if ((int)val==2){ + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); + if (*main_config.currentThemeIconSize!=32) + main_config.changed=1; + *main_config.currentThemeIconSize=32; + } + if ((int)val==3){ + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); + if (*main_config.currentThemeIconSize!=48) + main_config.changed=1; + *main_config.currentThemeIconSize=48; + } + if ((int)val==4){ + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); + if (*main_config.currentThemeIconSize!=64) + main_config.changed=1; + *main_config.currentThemeIconSize=64; + } +}; + +int on_settings_cancel(GtkWidget *button, actionWidgets *widgets){ + gtk_widget_hide(widgets->SettingsWindow); + setup_config(); +}; + +void on_caution_understand(GtkWidget *button,actionWidgets *widgets){ + gtk_widget_hide(widgets->CautionWindow); +} + +void on_section_settings_open(GtkButton* self,dictionary *cWidgets){ + actionWidgets *widgets=(actionWidgets*)cWidgets->data; + if (main_config.SettingsSections->first->data==NULL){ + char *name=((IconSection*)main_config.sections->first->data)->section; + char *categories=((IconSection*)main_config.sections->first->data)->categories; + main_config.SettingsSections->first->data=yon_create_section_setting(name, categories); + main_config.SettingsSections->first->key=name; + yon_segments_hide(widgets); + yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data); + for (dictionary *dct=main_config.sections->first->next;dct!=NULL;dct=dct->next){ // ошибка если меньше двух + name=((IconSection*)dct->data)->section; + categories=((IconSection*)dct->data)->categories; + main_config.SettingsSections=yon_dictionary_create_with_data_connected(main_config.SettingsSections,name,yon_create_section_setting(name, categories)); + main_config.SettingsSections->key=name; + yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data); + } + yon_segments_show(widgets); + + + } + gtk_window_present(GTK_WINDOW(widgets->SectionSettingsWindow)); +} + +void on_sections_edit(GtkWidget *button, actionWidgets *widgets){ + for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ + SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; + if (segment!=NULL){ + if (button==segment->ButtonEdit){ + gtk_widget_hide(segment->NameLabel); + gtk_widget_hide(segment->CategoriesLabel); + gtk_widget_show(segment->NameEntry); + gtk_widget_show(segment->CategoriesEntry); + gtk_widget_show(segment->EditButtonBox); + gtk_widget_hide(segment->DeleditBox); + gtk_widget_set_sensitive(segment->DragButtonBox,0); + + } else { + gtk_widget_set_sensitive(segment->OptionBox,0); + gtk_widget_set_sensitive(segment->DragButtonBox,0); + } + + } + } +}; + +void on_sections_accept(GtkWidget *button, actionWidgets *widgets){ + for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ + SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; + if (segment!=NULL){ + if (button==segment->EditButtonAccept){ + char *name=yon_char_get_augumented((char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)),""); + char *newname=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->NameEntry)),""); + char *newcats=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry)),""); + if (newcats[strlen(newcats)-1]!=';') + newcats=yon_char_get_augumented(newcats,";"); + gtk_label_set_text(GTK_LABEL(segment->NameLabel),gtk_entry_get_text(GTK_ENTRY(segment->NameEntry))); + gtk_label_set_text(GTK_LABEL(segment->CategoriesLabel),gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry))); + dictionary *toedit=yon_dictionary_find(&main_config.sections,name); + toedit->key=newname; + ((IconSection*)toedit->data)->section=newname; + ((IconSection*)toedit->data)->categories=newcats; + toedit=yon_dictionary_find(&main_config.SettingsSections,name); + toedit->key=newname; + ((IconSection*)toedit->data)->section=newname; + ((IconSection*)toedit->data)->categories=newcats; + gtk_widget_show(segment->NameLabel); + gtk_widget_show(segment->CategoriesLabel); + gtk_widget_hide(segment->NameEntry); + gtk_widget_hide(segment->CategoriesEntry); + gtk_widget_hide(segment->EditButtonBox); + gtk_widget_show(segment->DeleditBox); + gtk_widget_set_sensitive(segment->DragButtonBox,1); + + }else { + gtk_widget_set_sensitive(segment->OptionBox,1); + gtk_widget_set_sensitive(segment->DragButtonBox,1); + } + } + + } +}; + +void on_sections_cancel(GtkWidget *button, actionWidgets *widgets){ + for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ + SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; + if (segment!=NULL){ + if (button==segment->EditButtonCancel){ + gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),gtk_label_get_text(GTK_LABEL(segment->NameLabel))); + gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),gtk_label_get_text(GTK_LABEL(segment->CategoriesLabel))); + gtk_widget_show(segment->NameLabel); + gtk_widget_show(segment->CategoriesLabel); + gtk_widget_hide(segment->NameEntry); + gtk_widget_hide(segment->CategoriesEntry); + gtk_widget_hide(segment->EditButtonBox); + gtk_widget_show(segment->ButtonEdit); + gtk_widget_show(segment->DeleditBox); + gtk_widget_set_sensitive(segment->DragButtonBox,1); + + }else { + gtk_widget_set_sensitive(segment->OptionBox,1); + gtk_widget_set_sensitive(segment->DragButtonBox,1); + } + } + + } +}; + +void on_sections_move_up(GtkWidget *button, actionWidgets *widgets){ + for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ + SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; + if (segment!=NULL){ + if (button==segment->DragUpButton){ + yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1); + yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1); + yon_segments_hide(widgets); + yon_segments_show(widgets); + } + } + } +}; + +void on_sections_move_down(GtkWidget *button, actionWidgets *widgets){ + for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ + SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; + if (segment!=NULL){ + if (button==segment->DragDownButton){ + yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1); + yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1); + yon_segments_hide(widgets); + yon_segments_show(widgets); + } + } + } +}; + +void on_sections_add(GtkWidget *button, actionWidgets *widgets){ + char *category_name = yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry)),""); + if (strcmp(category_name,"")!=0){ + char *category_categories=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry)),""); + if (category_categories[strlen(category_categories)-1]!=';') + category_categories=yon_char_get_augumented(category_categories,";"); + SectionSettingSegment *segment=yon_create_section_setting(category_name,category_categories); + dictionary *newsection = yon_dictionary_get_last(main_config.SettingsSections); + newsection=yon_dictionary_create_with_data_connected(newsection,category_name,segment); + printf("%s\n",category_name); + dictionary *newsec=yon_dictionary_create_empty(); + newsec=yon_section_new(newsec,category_name,category_categories); + main_config.sections=yon_dictionary_create_with_data_connected(main_config.sections,category_name,newsec->data); + + gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); + gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); + yon_segment_show(widgets, segment); + yon_segments_hide(widgets); + yon_segments_show(widgets); + } +} + +void on_sections_new_clear(GtkWidget *button, actionWidgets *widgets){ + gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); + gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); +} + +void on_sections_close(GtkWidget *button, actionWidgets *widgets){ + gtk_widget_hide(widgets->SectionSettingsWindow); +} + +void on_sections_save(GtkWidget *button, dictionary *widgetsD){ + for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ + actionWidgets *widgets=(actionWidgets*)dict->data; + for (dictionary *ICSys=widgets->ICSys->first;ICSys!=NULL;ICSys=ICSys->next){ + gtk_container_remove(GTK_CONTAINER(widgets->icvpack),((IVGraphicals*)ICSys->data)->Box); + } + widgets->ICSys=yon_create_icon_section_list(main_config.sections); + for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){ + load_apps((IVGraphicals*)cur->data,widgets->applist,widgets->appssize); + } + yon_show_icon_views(widgets->ICSys,widgets); + hide_if_unfound(widgetsD); + } +} + +void on_section_delete(GtkWidget *button, actionWidgets *widgets){ + gtk_widget_destroy(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button))))); + for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){ + SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; + if (segment!=NULL){ + if (button==segment->ButtonDelete){ + main_config.sections=yon_dictionary_rip(yon_dictionary_find(&main_config.sections, dct->key)); + main_config.SettingsSections=yon_dictionary_rip(yon_dictionary_find(&main_config.SettingsSections, dct->key)); + break; + } + + } + } +} + +void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){ + actionWidgets *widgets=(actionWidgets*)widgetsD->data; + int x,y; + if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0) + main_config.fullscreen=0; + else + main_config.fullscreen=1; + gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight); + if (main_config.WindowTheme==1){ + if (main_config.windowWidth<1240){ + if (stld==0){ + stld=1; + main_config.WindowTheme=0; + + gtk_window_set_resizable(GTK_WINDOW(window),0); + gtk_window_get_position(GTK_WINDOW(window),&main_config.windowPosX,&main_config.windowPosY); + gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight); + yon_switch_theme(&widgetsD,yon_dictionary_find(&widgetsD,"Main")); + *main_config.currentThemeIconSize=24; + gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); + gtk_widget_hide(widgets->window); + } + }else { + yon_segments_hide(widgets); + yon_segments_show(widgets); + if (stld==1){ + stld=0; + cmld=0; + } + } + } +} + +void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){ + actionWidgets *widgets=(actionWidgets*)widgetsD->data; + if (event->type==GDK_CONFIGURE){ + if (stld==1){ + gtk_window_set_resizable(GTK_WINDOW(window),1); + } + } +} + + + +void on_theme_selection_changed(GtkWidget *self, actionWidgets *widgets){ + int *icsize; + int curthm=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); + if (curthm==0){ + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + icsize=main_config.currentThemeIconSize; + } + else if (curthm==1){ + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + icsize=main_config.currentThemeIconSize; + } + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + if (*icsize==24 || *icsize==1){ + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),1.0); + *icsize=24; + } else if (*icsize==32 || *icsize==2){ + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),2.0); + *icsize=32; + } else if (*icsize==48 || *icsize==3){ + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),3.0); + *icsize=48; + } else{ + gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),4.0); + *icsize=64; + } +} + +void on_about(GtkWidget *button){ + GtkBuilder *builder = gtk_builder_new_from_file(GladePath); + GtkWidget *AboutButtons = GTK_WIDGET(gtk_builder_get_object(builder,"AboutButtons")); + GtkWidget *About = GTK_WIDGET(gtk_builder_get_object(builder, "ublAbloutWindow")); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(About),_("Settings manager for UBLinux")); + gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(About),_("UBLinux Settings Manager")); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(About),version_application); + gtk_widget_show(About); + gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(About),_("Project Home Page")); + gtk_widget_set_visible(AboutButtons,0); +} + +int launch(thread_output *thread){ + int a=0; + a=system(thread->command); + *thread->exitcode=a; + return *thread->exitcode; +} + +int launch_app_with_arguments(char *name, char *args){ + char *path=yon_char_get_augumented("/usr/bin/",name); + path=yon_char_get_augumented(path," "); + path=yon_char_get_augumented(path,args); + pthread_t thread_id; + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); + pthread_create(&thread_id, NULL, (void*)launch, thread); + return *thread->exitcode; +}; + +int launch_app(char *name){ + char *path=name; + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void*)launch, thread); + return *thread->exitcode; +}; + +int py_launch_app(char *name,char *args){ + char *path=malloc(strlen("python ./")+strlen(name)+6+strlen(args)); + sprintf(path,"python ./%s.py %s &",name,args); + pthread_t thread_id; + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); + pthread_create(&thread_id, NULL, (void*)launch, thread); + return *thread->exitcode; +}; + +apps *get_app_by_name(apps *applist,char *name, int size){ + for (int i=0;iIV),GTK_TREE_MODEL(section->LV)); +} + +int load_apps(IVGraphicals *section, apps *applist, int size){ + int catstofind=sizeof(section->categories)/sizeof(char*); + int i=0,sz=0; + for (int i=0;icategories)==1){ + GError *err=NULL; + GtkTreeIter iter; + gtk_list_store_append(section->LV,&iter); + int sz= yon_get_icon_size(*main_config.currentThemeIconSize)+3; + if (sz<34) sz=34; + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + GdkPixbuf *pixbuf=gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, applist[i].Icon,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SIZE),NULL); + GtkTreePath *pth = gtk_tree_model_get_path(GTK_TREE_MODEL(section->LV),&iter); + gtk_list_store_set(section->LV,&iter,0,applist[i].Name,1,0.0,2,0.5, 3, sz+5, 4, pixbuf, 5,yon_get_icon_size(*main_config.currentThemeIconSize)+10, -1); + int cols = gtk_icon_view_get_columns(GTK_ICON_VIEW(section->IV)); + gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), -1); + gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), cols); + + } + + } + gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV)); +}; + +int load_apps_with_clear(IVGraphicals *section, apps *applist, int size){ + gtk_list_store_clear(section->LV); + load_apps(section,applist,size); +}; + +int hide_if_unfound(dictionary *widgetsD){ + for (dictionary *widgetsDc=widgetsD->first;widgetsDc!=NULL;widgetsDc=widgetsDc->next){ + actionWidgets *widgets=(actionWidgets*)widgetsDc->data; + for (dictionary *icvd=widgets->ICSys->first;icvd!=NULL;icvd=icvd->next){ + IVGraphicals *icv=icvd->data; + GtkTreeIter iter; + if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(icv->LV),&iter)==0){ + gtk_widget_hide(icv->Box); + gtk_widget_hide(GTK_WIDGET(icv->sep)); + } + } + } +} + +GtkWidget *create_socket(actionWidgets *builder){ + GtkWidget *socket; + socket = gtk_socket_new(); + GtkWidget *socketbutton=gtk_socket_new(); + GtkWidget *ThirdSocket=gtk_socket_new(); + g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(on_plug_added),builder); + g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(on_plug_removed),builder); + g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(on_plug_removed),builder); + gtk_box_pack_start(GTK_BOX(builder->socketplace),socket,true,true,0); + gtk_box_pack_start(GTK_BOX(builder->socketbuttonplace),socketbutton,1,1,0); + builder->socketbutton=socketbutton; + gtk_box_pack_start(GTK_BOX(builder->ThirdSocketPlace),ThirdSocket,1,1,0); + builder->ThirdSocket=ThirdSocket; + return socket; +}; + +void sort_apps(apps *applist,int size){ + apps tmp; + if (size>2) + { + for (int i=1;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(); + 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",NULL); + 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; +}; + +int check_categories(apps app, char *catstocheck){ + if (!catstocheck || strcmp(catstocheck,"")==0||strcmp(catstocheck,";")==0){ + char *found=strstr(app.Categories,"X-UBL-SettingsManager"); + char *perfound=strstr(app.Categories,"X-UBL-PersonalSettings"); + char *harfound=strstr(app.Categories,"X-UBL-HardwareSettings"); + char *sysfound=strstr(app.Categories,"X-UBL-SystemSettings"); + if (found!=NULL&&(perfound==NULL&&harfound==NULL&&sysfound==NULL)) return 1; + else if (found==NULL)return 0; + } else + { + char *left_cats=catstocheck; + char *cat=strstr(left_cats,";"); + if (!cat) return 0; + char *find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); + char *found=strstr(app.Categories,find_it); + int to_find=0, n_found=0; + to_find++; + if (!found) return 0; + n_found++; + while (cat){ + left_cats=cat+1; + char *fcat=app.Categories;//strstr(app.Categories,";"); + cat=strstr(cat+1,";"); + if (!cat) break; + find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); + char *found=strstr(app.Categories,find_it); + to_find++; + if (!found) break; + n_found++; + left_cats=cat+1; + if (strlen(left_cats)==0 ||strcmp(left_cats,"")==0) break; + } + if (to_find==n_found) return 1; else return 0; + } +}; + +int setup_config(){ + FILE *file; + GError *err=NULL; + main_config.sections=yon_dictionary_create_empty(); + main_config.SettingsSections=yon_dictionary_create_empty(); + GKeyFile *configfile = g_key_file_new(); + char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); + sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); + g_key_file_load_from_file(configfile,pth,G_KEY_FILE_KEEP_TRANSLATIONS,&err); + if (err){ + g_error_free(err); + err=NULL; + g_key_file_load_from_file(configfile,GlobalConfigPath,G_KEY_FILE_KEEP_TRANSLATIONS,&err); + if (err){ + g_error_free(err); + return 0; + } + } + char *foroutput=NULL; + char *line=NULL; + main_config.windowPosX=g_key_file_get_integer(configfile,"window","WindowPosX",NULL); + main_config.windowPosY=g_key_file_get_integer(configfile,"window","WindowPosY",NULL); + main_config.windowWidth=g_key_file_get_integer(configfile,"window","WindowWidth",NULL); + main_config.windowHeight=g_key_file_get_integer(configfile,"window","WindowHeight",NULL); + main_config.WindowTheme=g_key_file_get_integer(configfile,"window","WindowTheme",NULL); + main_config.Mainiconsize=g_key_file_get_integer(configfile,"window","MainIconSize",NULL); + main_config.Gnomeiconsize=g_key_file_get_integer(configfile,"window","GnomeIconSize",NULL); + main_config.iconSegmentSize=g_key_file_get_integer(configfile,"window","IconSegmentSize",NULL); + main_config.MainlabelSize=g_key_file_get_integer(configfile,"window","MainLabelSize",NULL); + main_config.GnomelabelSize=g_key_file_get_integer(configfile,"window","GnomeLabelSize",NULL); + main_config.labelDensity=g_key_file_get_integer(configfile,"window","LabelDensity",NULL); + main_config.lastUser=g_key_file_get_string(configfile,"window","User",NULL); + main_config.fullscreen=g_key_file_get_boolean(configfile,"window","fullscreen",NULL); + if (main_config.MainlabelSize==0) main_config.MainlabelSize=12; + if (main_config.labelDensity==0) main_config.labelDensity=0; + main_config.MainlabelSize=main_config.MainlabelSize*1000; + if (main_config.GnomelabelSize==0) main_config.GnomelabelSize=12; + main_config.GnomelabelSize=main_config.GnomelabelSize*1000; + + if (main_config.WindowTheme==0){ + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + main_config.currentThemeIconSize=&main_config.Mainiconsize; + } else if (main_config.WindowTheme==1){ + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + } + + yon_icon_size_convert(0); + gsize length=0; + char **a=g_key_file_get_keys(configfile,"sections",&length,NULL); + + if (!a){yon_set_default_sections(main_config.sections);} else { + for (int i=0;inext=NULL; + } + + if (main_config.windowWidth<1024&&main_config.windowHeight<720){ + main_config.WindowTheme=0; + } + return 1; +}; + +void save_config(actionWidgets *widgets){ + GKeyFile *gfile=g_key_file_new(); + + int sz=1,szm=1; + if (main_config.Gnomeiconsize==64) sz=4; + if (main_config.Gnomeiconsize==48) sz=3; + if (main_config.Gnomeiconsize==32) sz=2; + if (main_config.Gnomeiconsize==24) sz=1; + if (main_config.Mainiconsize==64) szm=4; + if (main_config.Mainiconsize==48) szm=3; + if (main_config.Mainiconsize==32) szm=2; + if (main_config.Mainiconsize==24) szm=1; + char *fromint=malloc(5); + memset(fromint,0,5); + GError *err=NULL; + char *login=getlogin(); + if (geteuid()==0){ + login=main_config.lastUser; + } else { + main_config.lastUser=login; + } + char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); + sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); + g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); + if (err){ + struct stat st = {0}; + char *ptdir=malloc(36+strlen(getlogin())); + sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager"); + if (stat(ptdir, &st) == -1) { + mkdir(ptdir, 0777); + } + FILE *fp; + fp=fopen(pth,"w"); + fclose(fp); + } + g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err); + if (main_config.fullscreen==0){ + sprintf(fromint,"%d",main_config.windowPosX); + g_key_file_set_string(gfile,"window","WindowPosX",fromint); + sprintf(fromint,"%d",main_config.windowPosY); + g_key_file_set_string(gfile,"window","WindowPosY",fromint); + sprintf(fromint,"%d",main_config.windowWidth); + g_key_file_set_string(gfile,"window","WindowWidth",fromint); + sprintf(fromint,"%d",main_config.windowHeight); + g_key_file_set_string(gfile,"window","WindowHeight",fromint); + } + g_key_file_set_boolean(gfile,"window","fullscreen",main_config.fullscreen); + sprintf(fromint,"%d",main_config.WindowTheme); + g_key_file_set_string(gfile,"window","WindowTheme",fromint); + sprintf(fromint,"%d",sz); + g_key_file_set_string(gfile,"window","GnomeIconSize",fromint); + sprintf(fromint,"%d",szm); + g_key_file_set_string(gfile,"window","MainIconSize",fromint); + sprintf(fromint,"%d",main_config.iconSegmentSize); + g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000)); + g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000)); + g_key_file_set_string(gfile,"window","MainLabelSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000)); + g_key_file_set_string(gfile,"window","LabelDensity",fromint); + g_key_file_set_string(gfile,"window","User",login); + g_key_file_save_to_file(gfile,pth,NULL); +} + +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; +} + +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; +} + +char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){ + char *cut=strstr(source,dividepos); + int leng=strlen(source)-strlen(cut); + cut=yon_char_divide(source,leng); + return cut; +} + +void yon_set_default_sections(dictionary *section){ + yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;"); + section=yon_dictionary_create_conneced(section); + yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;"); + section=yon_dictionary_create_conneced(section); + yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;"); + section=yon_dictionary_create_conneced(section); + yon_section_new(section,"Misc","X-UBL-SettingsManager;X-UBL-MiscSettings;"); +} + +IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ + IVGraphicals *IVG = malloc(sizeof(IVGraphicals)); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + GtkBuilder *builder = gtk_builder_new_from_file(GladePath); + GtkWidget *iv = GTK_WIDGET(gtk_builder_get_object(builder,"iconTemplate")); + gtk_widget_show(iv); + GtkWidget *label = gtk_label_new(_(name)); + GtkCellRendererPixbuf *iconRender = GTK_CELL_RENDERER_PIXBUF(gtk_builder_get_object(builder, "iconPic")); + PangoAttrList *attrs = pango_attr_list_new(); + PangoFontDescription *descr = pango_font_description_new(); + pango_font_description_set_weight(descr,PANGO_WEIGHT_BOLD); + int stretch = main_config.labelDensity; + if (stretch>8) + stretch = 4; + pango_font_description_set_stretch(descr,main_config.labelDensity); + pango_attr_list_insert(attrs,pango_attr_size_new(*main_config.currentThemeLabelSize)); + pango_attr_list_insert(attrs, pango_attr_font_desc_new(descr)); + gtk_label_set_attributes(GTK_LABEL(label),attrs); + gtk_widget_set_margin_end(label,6); + gtk_widget_set_margin_start(label,6); + gtk_widget_set_margin_bottom(label,2); + gtk_icon_view_set_spacing(GTK_ICON_VIEW(iv),20); + if (main_config.WindowTheme==1) { + gtk_icon_view_set_columns(GTK_ICON_VIEW(iv),1); + gtk_widget_set_name(iv,"GnomeIcon"); + gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),1); + gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); + } else { + gtk_icon_view_set_item_padding(GTK_ICON_VIEW(iv),3); + gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); + gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(iv),2); + } + GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); + GtkListStore *lv=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststoreTemplate")); + gtk_widget_set_name(sep,"SepIcon"); + gtk_widget_set_halign(box,0); + gtk_widget_set_valign(box,1); + gtk_widget_set_margin_end(sep,6); + gtk_widget_set_margin_start(sep,6); + gtk_icon_view_set_model(GTK_ICON_VIEW(iv),GTK_TREE_MODEL(lv)); + gtk_label_set_xalign(GTK_LABEL(label),0); + gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(box),sep,FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(box),iv,FALSE,FALSE,0); + IVG->sectionName=name; + IVG->categories=cats; + IVG->LV = lv; + IVG->Box = box; + IVG->IV = iv; + IVG->label = label; + IVG->sep = sep; + IVG->iconRender = iconRender; + return IVG; +} + +dictionary *yon_create_icon_section_list(dictionary *sections){ + if (!sections) + return NULL; + IVGraphicals *IVSections; + dictionary *IVDict=NULL; + sections=sections->first; + while (sections!=NULL){ + IconSection *name=(IconSection*)sections->data; + IVSections=yon_create_single_section_IV(name->section,name->categories); + if (!IVDict) { + IVDict=yon_dictionary_create_empty(); + IVDict->key=name->section; + IVDict->data=IVSections; + IVDict->first=IVDict; + } else { + IVDict=yon_dictionary_create_conneced(IVDict); + IVDict->key=name->section; + IVDict->data=IVSections; + } + sections=sections->next; + } + IVDict->next=NULL; + return IVDict->first; +} + +void yon_check_path(char *path){ + FILE *fp; + char *pth=malloc(255); + memset(path,0,255); + fp = popen("screenfetch -n -w -N", "r"); + fgets(pth, 255,fp)!=NULL; +} + +dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ + section->next=NULL; + IconSection *sct=malloc(sizeof(IconSection)); + dictionary *dict=yon_dictionary_create_empty();//malloc(sizeof(dictionary)); + sct->section=section_name; + sct->categories=categories; + dict->data=sct; + if (!section->data){ + section->data=dict->data; + section->first=section; + section->key=section_name; + } else { + dict->first=section->first; + section->next=dict; + dict->prev=section; + dict->key=section_name; + section=section->next; + } + + return section; +} + +void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned){ + for (dictionary *dict=icdict->first;dict!=NULL;dict=dict->next){ + IVGraphicals *icv=(IVGraphicals*)dict->data; + int width=gtk_paned_get_position(GTK_PANED(paned)); + int pos=(int)((double)width-20); + if (pos < 100) pos=100; + + gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),pos); + } +} + +char *yon_char_get_augumented(char *source, char *append){ + int size=strlen(source)+strlen(append)+1; + char *final=malloc(size); + memset(final,0,size); + sprintf(final,"%s%s",source,append); + return final; +} + +char *yon_char_new(char *chr){ + char *newchar=malloc(strlen(chr)+1); + memset(newchar,0,strlen(chr)+1); + memcpy(newchar,chr,strlen(chr)); + return newchar; +} + +int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets){ + for (dictionary *dct=IVS->first;dct!=NULL;dct=dct->next){ + IVGraphicals *iv=dct->data; + gtk_widget_show_all(iv->Box); + gtk_box_pack_start(GTK_BOX(widgets->icvpack),iv->Box,FALSE,FALSE,0); + if (main_config.WindowTheme==0) + g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_Item_activated),widgets); + else if (main_config.WindowTheme==1) + g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_gnome_Item_activated),widgets); + g_signal_connect(G_OBJECT(iv->IV),"selection-changed",G_CALLBACK(on_item_selection_changed),widgets); + + } +} + +dictionary *yon_dictionary_find(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; +} + +dictionary *yon_dictionary_rip(dictionary *dict){ + 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; + } +} + +void yon_switch_theme(dictionary **dict, dictionary *newone){ + dictionary *dct=*dict; + actionWidgets *widgets=(actionWidgets*)dct->data; + + gtk_widget_hide(widgets->window); + *dict=newone; + dct=*dict; + widgets=(actionWidgets*)dct->data; + gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); + gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); + if (strcmp(dct->key,"Gnome")==0){ + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + int x,y; + GdkRectangle workarea; + gdk_monitor_get_workarea(gdk_display_get_monitor(gdk_screen_get_display(gtk_window_get_screen(GTK_WINDOW(widgets->window))),0),&workarea); + gtk_window_get_size(GTK_WINDOW(widgets->window),&x, &y); + if (workarea.width<1240&&workarea.height<720){ + gtk_widget_show(widgets->CautionWindow); + dictionary *founddict=yon_dictionary_find(dict,"Main"); + dct=yon_dictionary_find(dict,"Gnome"); + yon_switch_theme(&dct,founddict); + gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); + gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); + main_config.WindowTheme=0; + main_config.curThemeName="Main"; + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),0); + gtk_window_present(GTK_WINDOW(widgets->CautionWindow)); + gtk_widget_show(widgets->MenuItemAboutSystem); + } else if (x<1240){ + gtk_window_resize(GTK_WINDOW(widgets->window),1245,y); + main_config.WindowTheme=1; + main_config.curThemeName="Gnome"; + gtk_widget_show(widgets->window); + gtk_widget_hide(widgets->MenuItemAboutSystem); + + }else{ + main_config.WindowTheme=1; + main_config.curThemeName="Gnome"; + gtk_widget_show(widgets->window); + gtk_widget_hide(widgets->MenuItemAboutSystem); + } + + } else { + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + gtk_widget_show(widgets->window); + main_config.WindowTheme=0; + main_config.curThemeName="Main"; + gtk_widget_show(widgets->MenuItemAboutSystem); + } + + +} + +int yon_get_icon_size(int size){ + if (size==1||size==24) return 24; + if (size==2||size==32) return 32; + if (size==3||size==48) return 48; + if (size==4||size==64) return 64; +} + +void yon_icon_size_convert(int mode){ + if (mode==0){ + if (*main_config.currentThemeIconSize==1) *main_config.currentThemeIconSize=24; + if (*main_config.currentThemeIconSize==2) *main_config.currentThemeIconSize=32; + if (*main_config.currentThemeIconSize==3) *main_config.currentThemeIconSize=48; + if (*main_config.currentThemeIconSize==4) *main_config.currentThemeIconSize=64; + } else if (mode==1){ + if (*main_config.currentThemeIconSize==24) *main_config.currentThemeIconSize=1; + if (*main_config.currentThemeIconSize==32) *main_config.currentThemeIconSize=2; + if (*main_config.currentThemeIconSize==48) *main_config.currentThemeIconSize=3; + if (*main_config.currentThemeIconSize==64) *main_config.currentThemeIconSize=4; + } +} + +SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ + SectionSettingSegment *segment=malloc(sizeof(SectionSettingSegment)); + segment->MainFrame=gtk_frame_new(NULL); + gtk_frame_set_shadow_type(GTK_FRAME(segment->MainFrame),GTK_SHADOW_IN); + segment->MainBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + segment->ElemBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + gtk_widget_set_size_request(segment->ElemBox,0,20); + segment->DragButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + gtk_widget_set_name(segment->DragButtonBox,"noborders"); + segment->DragUpButton=gtk_button_new_from_icon_name("go-top-symbolic",GTK_ICON_SIZE_BUTTON); + segment->DragDownButton=gtk_button_new_from_icon_name("go-bottom-symbolic",GTK_ICON_SIZE_BUTTON); + segment->NameBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + segment->CategoriesBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + segment->OptionBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + segment->NameEntry=gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),name); + segment->NameLabel=gtk_label_new(name); + segment->CategoriesEntry=gtk_entry_new(); + if (categories[strlen(categories)-1]!=';'){ + categories=yon_char_get_augumented(categories,";"); + } + gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),categories); + segment->CategoriesLabel=gtk_label_new(categories); + segment->EditButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + segment->EditButtonAccept=gtk_button_new_from_icon_name("emblem-ok-symbolic",GTK_ICON_SIZE_BUTTON); + segment->EditButtonCancel=gtk_button_new_from_icon_name("process-stop-symbolic",GTK_ICON_SIZE_BUTTON); + segment->ButtonEdit=gtk_button_new_from_icon_name("document-edit-symbolic",GTK_ICON_SIZE_BUTTON); + segment->DeleditBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); + segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete-symbolic",GTK_ICON_SIZE_BUTTON); + + gtk_widget_set_name(segment->NameLabel,"SegName"); + gtk_widget_set_name(segment->CategoriesLabel,"SegCat"); + + gtk_container_add(GTK_CONTAINER(segment->MainFrame),segment->MainBox); + + gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->DragButtonBox,FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->ElemBox,TRUE,TRUE,0); + + gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragUpButton,FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragDownButton,FALSE,FALSE,0); + + gtk_box_pack_start(GTK_BOX(segment->ElemBox),segment->NameBox,FALSE,FALSE,0); + gtk_box_pack_end(GTK_BOX(segment->ElemBox),segment->CategoriesBox,FALSE,FALSE,0); + + gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->OptionBox,FALSE,FALSE,0); + + gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameEntry,FALSE,FALSE,5); + gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameLabel,FALSE,FALSE,5); + + gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesEntry,FALSE,FALSE,5); + gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesLabel,FALSE,FALSE,5); + + gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonAccept,FALSE,FALSE,5); + gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonCancel,FALSE,FALSE,5); + + gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonEdit,FALSE,FALSE,5); + gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonDelete,FALSE,FALSE,5); + + gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->DeleditBox,FALSE,FALSE,0); + gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->EditButtonBox,FALSE,FALSE,0); + + gtk_widget_set_size_request(segment->NameLabel,60,10); + + gtk_widget_set_margin_start(segment->DragButtonBox,5); + gtk_widget_set_margin_end(segment->OptionBox,5); + gtk_widget_set_margin_bottom(segment->MainFrame,3); + gtk_widget_set_margin_bottom(segment->DragButtonBox,3); + gtk_widget_set_margin_top(segment->DragButtonBox,3); + gtk_widget_set_margin_end(segment->DragUpButton,3); + + gtk_widget_set_halign(segment->NameEntry,GTK_ALIGN_START); + gtk_widget_set_halign(segment->NameLabel,GTK_ALIGN_END); + gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); + gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); + + gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); + gtk_widget_set_valign(segment->ElemBox,GTK_ALIGN_CENTER); + gtk_label_set_xalign(GTK_LABEL(segment->NameLabel),0); + gtk_label_set_xalign(GTK_LABEL(segment->CategoriesLabel),0); + + gtk_widget_set_vexpand(segment->ElemBox,0); + gtk_widget_set_vexpand(segment->NameBox,0); + gtk_widget_set_vexpand(segment->CategoriesBox,0); + gtk_widget_set_vexpand(segment->NameEntry,0); + gtk_widget_set_vexpand(segment->NameLabel,0); + gtk_widget_set_vexpand(segment->CategoriesEntry,0); + gtk_widget_set_vexpand(segment->CategoriesLabel,0); + gtk_widget_show_all(segment->MainFrame); + gtk_widget_hide(segment->NameEntry); + gtk_widget_hide(segment->CategoriesEntry); + gtk_widget_hide(segment->EditButtonBox); + return segment; +} + +dictionary *yon_dictionary_create_empty(){ + dictionary *dict=malloc(sizeof(dictionary)); + dict->data=NULL; + dict->key=NULL; + dict->next=NULL; + dict->prev=NULL; + dict->first=dict; + return dict; +} + +void yon_dictionary_switch_to_last(dictionary **dict){ + if ((*dict)->next!=NULL) + for ((*dict)=(*dict)->first;(*dict)->next!=NULL;(*dict)=(*dict)->next){} +} + +dictionary * yon_dictionary_create_conneced(dictionary *targetdict){ + yon_dictionary_switch_to_last(&targetdict); + targetdict->next=yon_dictionary_create_empty(); + targetdict->next->prev=targetdict; + targetdict->next->first=targetdict->first; + return targetdict->next; +} + +void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm){ + gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); + g_signal_connect(G_OBJECT(sgm->ButtonEdit),"clicked",G_CALLBACK(on_sections_edit), widgets); + g_signal_connect(G_OBJECT(sgm->EditButtonAccept),"clicked",G_CALLBACK(on_sections_accept), widgets); + g_signal_connect(G_OBJECT(sgm->EditButtonCancel),"clicked",G_CALLBACK(on_sections_cancel), widgets); + g_signal_connect(G_OBJECT(sgm->DragUpButton),"clicked",G_CALLBACK(on_sections_move_up), widgets); + g_signal_connect(G_OBJECT(sgm->DragDownButton),"clicked",G_CALLBACK(on_sections_move_down), widgets); + g_signal_connect(G_OBJECT(sgm->ButtonDelete),"clicked",G_CALLBACK(on_section_delete), widgets); + +} + +void yon_segments_show(actionWidgets *widgets){ + if(widgets->SettingsSections) + for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){ + SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; + if (sgm!=NULL) + + gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); + else return; + } +}; + +void yon_segments_hide(actionWidgets *widgets){ + if(main_config.SettingsSections) + for (dictionary *dict=main_config.SettingsSections->first;dict!=NULL;dict=dict->next){ + SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; + if (sgm!=NULL){ + g_object_ref(G_OBJECT(sgm->MainFrame)); + gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),sgm->MainFrame); + } else return; + } +} + +void yon_dictionary_make_first(dictionary *dict){ + for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ + dct->first=dict; + } +} +void yon_dictionary_make_nth(dictionary *dict, int nth){ + dictionary *dct=dict->first; + for (int i=0;inext;} + yon_dictionary_rip(dict); + dictionary *prev=dct->prev; + prev->next=dict; + dict->prev=prev; + dict->next=dct; + dct->prev=dict; +} + +dictionary *yon_dictionary_create_with_data(char *key, void *data){ + dictionary *dct=yon_dictionary_create_empty(); + dct->key=key; + dct->data=data; + return dct; +} + +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data){ + dictionary *dct=yon_dictionary_create_conneced(dict); + dct->key=key; + dct->data=data; + return dct; +} + +dictionary *yon_dictionary_switch_places(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; + } + } + } + } +} + +dictionary *yon_dictionary_get_last(dictionary *dict){ + for (dictionary *dct=dict;dct!=NULL;dct=dct->next){} + return dict; +} + +void yon_main_quit(actionWidgets *widgets){ + save_config(widgets); + gtk_main_quit(); +} + +dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize){ + + dictionary *widgets=*widgetss; + actionWidgets *curWidgets=(actionWidgets*)widgets->data; + if (curWidgets==NULL) { + curWidgets=malloc(sizeof(actionWidgets)); + widgets->data=curWidgets; + } + widgets->key=theme_id; + curWidgets->builder=builder; + curWidgets->window=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Window"))); + curWidgets->DesktopBasic=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"HideWhileLaunch"))); + curWidgets->DesktopSocket=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketplace"))); + curWidgets->ButtonBackToMain=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"backToSettingsButton"))); + curWidgets->appSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"appSettings"))); + curWidgets->socketplace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketplace"))); + curWidgets->HideWhileLaunch=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"HideWhileLaunch"))); + curWidgets->workingwindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"workingwindow"))); + curWidgets->icvpack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"icvpack"))); + curWidgets->GnomePaned=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Paned"))); + curWidgets->GnomeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoLabel"))); + curWidgets->GnomeInfoDetailsLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoDetailsLabel"))); + curWidgets->socketbuttonplace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketbuttonplace"))); + curWidgets->Overlay=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Overlay"))); + curWidgets->ThirdSocketPlace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"ThirdSocketPlace"))); + curWidgets->MenuItemSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemSettings"))); + curWidgets->MenuItemDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemDocumentation"))); + curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemAboutSystem"))); + curWidgets->SettingsSections=main_config.SettingsSections; + if (main_config.lock_settings==1){ + gtk_widget_set_sensitive(curWidgets->MenuItemSettings,0); + } + gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview"); + curWidgets->socket=GTK_WIDGET(create_socket(curWidgets)); + if (curWidgets->ButtonBackToMain!=NULL) + gtk_button_set_label(GTK_BUTTON(curWidgets->ButtonBackToMain),_("Back to all settings")); + gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager")); + if (curWidgets->GnomePaned!=NULL){ + gtk_paned_set_position(GTK_PANED(curWidgets->GnomePaned),main_config.iconSegmentSize); + g_signal_connect(G_OBJECT(curWidgets->GnomePaned), "notify::position", G_CALLBACK(on_paned_move), curWidgets); + + } + g_signal_connect(G_OBJECT(curWidgets->window), "configure-event", G_CALLBACK(on_resized), widgets); + if (strcmp(theme_id,"Gnome")==0){ + g_signal_connect(G_OBJECT(curWidgets->window), "event-after", G_CALLBACK(on_resized_done), widgets); + + } + if (curWidgets->ButtonBackToMain!=NULL) + g_signal_connect(G_OBJECT(curWidgets->ButtonBackToMain), "clicked", G_CALLBACK(on_backToSettingsButton_clicked), curWidgets); + curWidgets->LabelTitle=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"LabelTitle")); + gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager")); + + // Standard for all themes + + curWidgets->settingsThemeChooser=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsThemeChooser")); + curWidgets->SettingsWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SettingsWindow")); + curWidgets->DialogOpenDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"HelpSureWindow")); + curWidgets->CancelHelpButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CancelHelpButton")); + curWidgets->ReadHelpButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"ReadHelpButton")); + curWidgets->AlwaysOpenDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"AlwaysOpenHelpCheckbox")); + curWidgets->helpHeader=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"helpHeader")); + curWidgets->helpText=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"helpText")); + curWidgets->settingsSizeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSizeInfoLabel")); + curWidgets->settingsIcon=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsIcon")); + curWidgets->SectionSettingsWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsWindow")); + curWidgets->SectionSettingsPack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsPack")); + curWidgets->settingsSizeSlider=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSizeSlider")); + curWidgets->settingsAccept=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsAccept")); + curWidgets->settingsCancel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsCancel")); + curWidgets->settingsSubmenuLabelSize=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSubmenuLabelSize")); + curWidgets->settingsSubmenuLabelTheme=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSubmenuLabelTheme")); + curWidgets->settingsSectionsSettingsButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSectionsSettingsButton")); + curWidgets->SectionSettingAddButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddButton")); + curWidgets->SectionSettingAddNameEntry=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddNameEntry")); + curWidgets->SectionSettingAddCategoriesEntry=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddCategoriesEntry")); + curWidgets->SectionSettingsClearEntryButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsClearEntryButton")); + curWidgets->SectionSettingsSaveButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsSaveButton")); + curWidgets->SectionSettingsCloseButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsCloseButton")); + curWidgets->CautionWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CautionWindow")); + curWidgets->CautionUnderstandButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CautionUnderstandButton")); + curWidgets->infoWarningWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"windowSettings-infoWarning")); + curWidgets->infoWarningButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"buttonSettings-infoWarning")); + curWidgets->infoWarningLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"labelSettings-infoWarning")); + curWidgets->applist=applist; + curWidgets->appssize=appsize; + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + gtk_widget_set_size_request(curWidgets->window,800,600); + gtk_window_resize(GTK_WINDOW(curWidgets->window),main_config.windowWidth,main_config.windowHeight); + gtk_window_set_icon(GTK_WINDOW(curWidgets->window),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_window_set_icon(GTK_WINDOW(curWidgets->SectionSettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + g_signal_connect(G_OBJECT(curWidgets->MenuItemDocumentation), "activate", G_CALLBACK(on_about), curWidgets->builder); //on_ButtonOpenHelp_activated + g_signal_connect(G_OBJECT(curWidgets->MenuItemSettings), "activate", G_CALLBACK(on_settingsOpen), curWidgets); + + if (gnld==0){ + gnld=1; + g_signal_connect(G_OBJECT(curWidgets->settingsThemeChooser), "changed", G_CALLBACK(on_theme_selection_changed), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->CancelHelpButton), "clicked", G_CALLBACK(on_CancelHelpButton_activated), curWidgets->builder); + g_signal_connect(G_OBJECT(curWidgets->ReadHelpButton), "clicked", G_CALLBACK(on_ReadHelpButton_activated), curWidgets->builder); + g_signal_connect(G_OBJECT(curWidgets->settingsSizeSlider), "value-changed", G_CALLBACK(on_settings_icon_size_changed), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->settingsCancel), "clicked", G_CALLBACK(on_settings_cancel), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->settingsAccept), "clicked", G_CALLBACK(on_settings_accept), widgetss); + g_signal_connect(G_OBJECT(curWidgets->SectionSettingAddButton), "clicked", G_CALLBACK(on_sections_add), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->SectionSettingsClearEntryButton), "clicked", G_CALLBACK(on_sections_new_clear), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->SectionSettingsCloseButton), "clicked", G_CALLBACK(on_sections_close), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->SectionSettingsSaveButton), "clicked", G_CALLBACK(on_sections_save), widgets); + g_signal_connect(G_OBJECT(curWidgets->CautionUnderstandButton), "clicked", G_CALLBACK(on_caution_understand), curWidgets); + g_signal_connect(G_OBJECT(curWidgets->settingsSectionsSettingsButton), "clicked", G_CALLBACK(on_section_settings_open), widgets); + } + g_signal_connect(G_OBJECT(curWidgets->window), "destroy", G_CALLBACK(yon_main_quit), curWidgets); + gtk_label_set_text(GTK_LABEL(curWidgets->LabelTitle),_("UBLinux Settings Manager")); + gtk_label_set_text(GTK_LABEL(curWidgets->settingsSubmenuLabelSize),_("Icon size")); + gtk_label_set_text(GTK_LABEL(curWidgets->settingsSubmenuLabelTheme),_("Window theme")); + gtk_label_set_text(GTK_LABEL(curWidgets->helpHeader),_("Would you like to read documentation in the Web?")); + gtk_label_set_text(GTK_LABEL(curWidgets->helpText),_("You will be redirected to documentation site, where user help pages are translated and supported by community.")); + gtk_button_set_label(GTK_BUTTON(curWidgets->ReadHelpButton),_("Read online")); + gtk_button_set_label(GTK_BUTTON(curWidgets->CancelHelpButton),_("Cancel")); + gtk_button_set_label(GTK_BUTTON(curWidgets->settingsCancel),_("Close")); + gtk_button_set_label(GTK_BUTTON(curWidgets->settingsAccept),_("Save and apply")); + gtk_button_set_label(GTK_BUTTON(curWidgets->AlwaysOpenDocumentation),_("Always redirect")); + gtk_menu_item_set_label(GTK_MENU_ITEM(curWidgets->MenuItemSettings),_("Settings")); + gtk_menu_item_set_label(GTK_MENU_ITEM(curWidgets->MenuItemDocumentation),_("About...")); + gtk_button_set_label(GTK_BUTTON(curWidgets->CautionUnderstandButton),_("Understood")); + gtk_button_set_label(GTK_BUTTON(curWidgets->settingsSectionsSettingsButton),_("Sections management")); + return widgets; +} + +int main(int argc, char *argv[]){ + local=setlocale(LC_ALL, ""); + textdomain (LocaleName); + static struct option long_options[] = { + {"lock-settings", 0, 0, 'l'}, + {"help", 0, 0, 'h'}, + {"version", 0, 0, 'v'}, + }; + int socket_find; + int option_index=0; + for (int i=0;idata=widget; + int *size=malloc(sizeof(int)); + apps *applist=find_apps(size); + sort_apps(applist,*size); + GtkBuilder *builder=gtk_builder_new_from_file(GladePath); + actionWidgets *widg=(actionWidgets*)widgets->first->data; + char *theme; + if (main_config.WindowTheme==1){ theme="Gnome"; + yon_theme_new(&widgets->first, builder,theme,applist,*size); + widg->applist=applist; + widg->appssize=*size; + widg->ICSys=yon_create_icon_section_list(main_config.sections); + for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ + load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); + } + yon_show_icon_views(widg->ICSys,widg); + yon_icv_resize_item(widg->ICSys,widg->GnomePaned); + theme="Main"; + main_config.WindowTheme=0; + widgets->next=yon_dictionary_create_empty(); + widgets->next->first=widgets; + widgets->next->prev=widgets; + yon_theme_new(&widgets->next, builder,theme,applist,*size); + widg=(actionWidgets*)widgets->next->data; + widg->applist=applist; + widg->appssize=*size; + widg->ICSys=yon_create_icon_section_list(main_config.sections); + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ + load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); + } + yon_show_icon_views(widg->ICSys,widg); + main_config.WindowTheme=1; + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + } + else { + theme="Main"; + yon_theme_new(&widgets->first, builder,theme,applist,*size); + widg->applist=applist; + widg->appssize=*size; + widg->ICSys=yon_create_icon_section_list(main_config.sections); + for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ + load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); + } + yon_show_icon_views(widg->ICSys,widg); + theme="Gnome"; + main_config.WindowTheme=1; + widgets->next=yon_dictionary_create_empty(); + widgets->next->first=widgets; + widgets->next->prev=widgets; + yon_theme_new(&widgets->next, builder,theme,applist,*size); + widg=(actionWidgets*)widgets->next->data; + widg->applist=applist; + widg->appssize=*size; + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + widg->ICSys=yon_create_icon_section_list(main_config.sections); + for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ + load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); + } + yon_show_icon_views(widg->ICSys,widg); + main_config.WindowTheme=0; + yon_icv_resize_item(widg->ICSys,widg->GnomePaned); + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + } + if (geteuid()==0){ + } + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widg->settingsThemeChooser),NULL,_("Standard theme")); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widg->settingsThemeChooser),NULL,_("GNOME theme")); + widg=(actionWidgets*)widgets->data; + if (main_config.fullscreen==1) + gtk_window_maximize(GTK_WINDOW(widg->window)); + gtk_widget_show(widg->window); + hide_if_unfound(widgets); + if (main_config.WindowTheme==1) + gtk_widget_hide(widg->MenuItemAboutSystem); + GtkWidget *banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"MainBanner")); + gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file(AppBannerPath,NULL)); + banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"GnomeBanner")); + gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file(AppBannerPath,NULL)); + banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"loaderBanner")); + gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file(AppBannerPath,NULL)); + banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"GnomeInfoLogo")); + gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file_at_scale(ublinux_logo,512,512,1,NULL)); + banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"settingsIcon")); + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + GtkCssProvider *css=gtk_css_provider_new(); + gtk_css_provider_load_from_path(css,CssPath,NULL); + gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), + GTK_STYLE_PROVIDER(css), + -1); + gtk_main(); + +} +#endif \ No newline at end of file diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h new file mode 100644 index 0000000..383bd04 --- /dev/null +++ b/source/ubl-settings-manager.h @@ -0,0 +1,239 @@ +#ifndef UBL_SETTINGS_MANAGER +#define UBL_SETTINGS_MANAGER + +#include +#include +#include + +#define cmdVersionText yon_char_get_augumented(yon_char_get_augumented(_("Version: "),version_application),"\n") +#define cmdHelpText yon_char_get_augumented(yon_char_get_augumented(_("ubl-settings-manager version: "),version_application),_("\nGTK settings manager for UBLinux\nUsage: ubl-settings-manager [OPTIONS...]\nOptions:\n -h, --help Show this help\n -V, --version Show package version\n --lock-settings Lock menu settings\n")) +#define GladePath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager.glade" +#define CssPath "/usr/share/ubl-settings-manager/css/ubl-settings-manager.css" +#define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf" +#define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf" +#define AppIconPath "ru.ublinux.ubl-settings-manager" +#define AppBannerPath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager-banner.png" +#define DesktopPath "/usr/share/applications/" +#define IconPicturesPath "/usr/share/icons/hicolor/scalable/apps/" +#define ublinux_logo "/usr/share/ubl-settings-manager/ui/ublinux-logo.svg" +#define LocalePath "/usr/share/locale" +#define LocaleName "ubl-settings-manager" +#define ubl_settings_infoPath "ubl-settings-info" +#define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id=" +typedef char* string; +string version_application = ; + + +typedef struct apps{ + char *Name; + int Type; + char *Categories; + char *Exec; + char *Icon; + int Pluggable; + int DualPluggable; + } apps; + +typedef struct { + char *command; + int *exitcode; +} thread_output; + +typedef struct dictionary { + char *key; + void *data; + struct dictionary *next; + struct dictionary *prev; + struct dictionary *first; +} dictionary; + +typedef struct IVGrapgicals{ + char *sectionName; + char *categories; + GtkListStore *LV; + GtkWidget *Box; + GtkWidget *IV; + GtkWidget *label; + GtkWidget *sep; + GtkCellRendererPixbuf *iconRender; +} IVGraphicals; + +typedef struct IconSection{ + char *section; + char *categories; +} IconSection; + +typedef struct { + int windowWidth; + int windowHeight; + int windowPosX; + int windowPosY; + int WindowTheme; + char *curThemeName; + int Mainiconsize; + int Gnomeiconsize; + int iconSegmentSize; + dictionary *sections; + int MainlabelSize; + int GnomelabelSize; + int *currentThemeLabelSize; + int *currentThemeIconSize; + int labelDensity; + char *lastUser; + int changed; + int fullscreen; + int lock_settings; + dictionary *SettingsSections; +} config; + +typedef struct { + GtkWidget *MainFrame; + GtkWidget *MainBox; + GtkWidget *ElemBox; + GtkWidget *DragButtonBox; + GtkWidget *DragUpButton; + GtkWidget *DragDownButton; + GtkWidget *NameBox; + GtkWidget *CategoriesBox; + GtkWidget *OptionBox; + GtkWidget *NameEntry; + GtkWidget *NameLabel; + GtkWidget *CategoriesEntry; + GtkWidget *CategoriesLabel; + GtkWidget *EditButtonBox; + GtkWidget *EditButtonAccept; + GtkWidget *EditButtonCancel; + GtkWidget *ButtonEdit; + GtkWidget *ButtonDelete; + GtkWidget *DeleditBox; +} SectionSettingSegment; + +typedef struct { + GtkBuilder *builder; + GtkWidget *window; + dictionary *ICSys; + GtkWidget *DesktopBasic; + GtkWidget *DesktopSocket; + GtkWidget *ButtonBackToMain; + GtkWidget *DialogOpenDocumentation; + GtkWidget *CancelHelpButton; + GtkWidget *ReadHelpButton; + GtkWidget *AlwaysOpenDocumentation; + GtkWidget *helpHeader; + GtkWidget *helpText; + GtkWidget *appSettings; + GtkWidget *SettingsWindow; + GtkWidget *settingsSizeSlider; + GtkWidget *settingsSizeInfoLabel; + GtkWidget *settingsThemeChooser; + GtkWidget *settingsCancel; + GtkWidget *settingsAccept; + GtkWidget *settingsIcon; + GtkWidget *socket; + GtkWidget *socketplace; + GtkWidget *HideWhileLaunch; + GtkWidget *MenuItemSettings; + GtkWidget *MenuItemDocumentation; + GtkWidget *MenuItemAboutSystem; + GtkWidget *LabelTitle; + GtkWidget *settingsSubmenuLabelSize; + GtkWidget *settingsSubmenuLabelTheme; + GtkWidget *GnomePaned; + GtkWidget *GnomeInfoLabel; + GtkWidget *workingwindow; + GtkWidget *settingsSectionsSettingsButton; + GtkWidget *SectionSettingsWindow; + GtkWidget *SectionSettingsPack; + dictionary *SettingsSections; + GtkWidget *SectionSettingAddButton; + GtkWidget *SectionSettingAddNameEntry; + GtkWidget *SectionSettingAddCategoriesEntry; + GtkWidget *SectionSettingsClearEntryButton; + GtkWidget *SectionSettingsSaveButton; + GtkWidget *SectionSettingsCloseButton; + GtkWidget *GnomeInfoDetailsLabel; + GtkWidget *CautionWindow; + GtkWidget *CautionUnderstandButton; + GtkWidget *socketbuttonplace; + GtkWidget *socketbutton; + GtkWidget *Overlay; + GtkWidget *ThirdSocketPlace; + GtkWidget *ThirdSocket; + int appssize; + apps *applist; + GtkWidget *icvpack; + GtkWidget *infoWarningWindow; + GtkWidget *infoWarningButton; + GtkWidget *infoWarningLabel; + +} actionWidgets; + +typedef enum { + ACTIONWIDGETS, + ICONSECTION, + IVGRAPHICALS, + OTHER + +} DICT_TYPE; + +void on_plug_added(GtkSocket* self, actionWidgets *builder); +void on_plug_removed(GtkSocket* self, actionWidgets *widgets); +void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist); +void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist); +void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets); +void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder); +void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb); +void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder); +void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder); +int launch_app_with_arguments(char *name, char *args); +int launch_app(char *name); +int py_launch_app(char *name,char *args); +int on_settings_accept(GtkWidget *button, dictionary **widgetsDs); +void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets); +int on_settingsOpen(GtkWidget *button, actionWidgets *widgets); +int on_settings_icon_size_changed(GtkWidget* self, actionWidgets *widgets); +int on_settings_cancel(GtkWidget *button, actionWidgets *widgets); +apps *get_app_by_name(apps *applist,char *name, int size); +int reload_list(IVGraphicals *section); +int load_apps(IVGraphicals *section, apps *applist, int size); +int load_apps_with_clear(IVGraphicals *section, apps *applist, int size); +int hide_if_unfound(dictionary *widgetsDc); +GtkWidget *create_socket(actionWidgets *builder); +void sort_apps(apps *applist,int size); +apps *find_apps(int *sizef); +int check_categories(apps app, char *catstocheck); +int setup_config(); +void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned); +dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize); +char *yon_char_get_augumented(char *source, char *append); +char *yon_cut(char *source, int size, int startpos); +int yon_set_sections(IconSection *section); +void yon_set_default_sections(dictionary *section); +char *yon_char_divide_search(char *source, char* dividepos, int delete_divider); +char *yon_char_divide(char *source, int dividepos); +dictionary *yon_section_new(dictionary *section, char *section_name, char *categories); +void yon_switch_theme(dictionary **dict, dictionary *newone); +dictionary *yon_dictionary_find(dictionary **dict, char *key); +void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm); +dictionary *yon_dictionary_create_empty(); +dictionary *yon_dictionary_rip(dictionary *dict); +dictionary *yon_dictionary_get_last(dictionary *dict); +dictionary *yon_dictionary_switch_places(dictionary *dict,int aim); +dictionary *yon_dictionary_create_with_data(char *key, void *data); +dictionary *yon_dictionary_create_with_data_connected(dictionary *dict, char *key, void *data); +SectionSettingSegment *yon_create_section_setting(char *name, char *categories); +void yon_segments_show(actionWidgets *widgets); +void yon_segments_hide(actionWidgets *widgets); +void yon_dictionary_make_first(dictionary *dict); +dictionary *yon_create_icon_section_list(dictionary *sections); +int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets); +void yon_icon_size_convert(int mode); +char *yon_char_new(char *chr); +int launch(thread_output *thread); +float yon_time_average(dictionary *times); +void yon_time_reg_for_average(dictionary *listofregs, int size, time_t tm); +void yon_dictionary_switch_to_last(dictionary **dict); +dictionary *yon_dictionary_create_conneced(dictionary *targetdict); +int yon_get_icon_size(int size); + +#endif \ No newline at end of file diff --git a/ubl-settings-manager-banner.png b/ubl-settings-manager-banner.png new file mode 100644 index 0000000..b7f6b74 Binary files /dev/null and b/ubl-settings-manager-banner.png differ diff --git a/ubl-settings-manager.conf b/ubl-settings-manager.conf new file mode 100644 index 0000000..e8ceb76 --- /dev/null +++ b/ubl-settings-manager.conf @@ -0,0 +1,19 @@ +[window] +WindowPosX=0 +WindowPosY=0 +WindowWidth=800 +WindowHeight=600 +WindowTheme=0 +MainIconSize=3 +GnomeIconSize=3 +IconSegmentSize=250 +MainLabelSize=12 +GnomeLabelSize=12 +LabelDensity=0 +User= + +[sections] +Personal=X-UBL-SettingsManager;X-UBL-PersonalSettings; +Hardware=X-UBL-SettingsManager;X-UBL-HardwareSettings; +System=X-UBL-SettingsManager;X-UBL-SystemSettings; +Misc= diff --git a/ubl-settings-manager.css b/ubl-settings-manager.css new file mode 100644 index 0000000..67166dc --- /dev/null +++ b/ubl-settings-manager.css @@ -0,0 +1,108 @@ +.bannerbackground { +background-color: #404040; +} + + +#GnomeIcon{ + border-style:solid; + border-bottom-width: 1px; + border-image: linear-gradient(90deg, alpha(@theme_text_color,0.4) 55%, alpha(@theme_bg_color, 0) 100%); + border-image-slice: 1; +} + +#SepIcon{ + background-color: alpha(@theme_text_color, 0.6); +} + +#iconlabel { + font-size:14px; + font-weight: bold; + +} +.roundborder * { + border-width:0px; + border-radius:5px; +} +.noborder { + border: none; +} +.menu:hover { + border-color:alpha(@theme_text_color, 0.01); +} +.menu { + border-color:alpha(@theme_text_color, 0.01); +} +.menu:hover >* { + border-color:alpha(@theme_text_color, 0.01); +} +.menuitembottom{ + margin-top:0px; + margin-bottom:3px; +} +.menuitemmiddle{ + margin-top:0px; + margin-bottom:0px; +} + +.menuitemtop{ + margin-bottom:0px; +} +.menuitemtop *{ + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; +} +.menuitemmiddle *{ + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; +} +.menuitembottom *{ + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; +} +.menuitemtop:hover { + background:@theme_bg_color; +} +.menuitemmiddle:hover { + background:@theme_bg_color; +} +.menuitembottom:hover { + background:@theme_bg_color; + +} +.menuitemtop:hover* { + margin:2px 2px 0 2px; + padding: 5px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; +} +.menuitemmiddle:hover* { + margin:0 2px 0 2px; + padding: 3px 10px 3px 5px; + background:@theme_selected_bg_color; + border-radius:2px; +} +.menuitembottom:hover* { + margin:0 2px 2px 2px; + padding: 3px 10px 5px 5px; + background:@theme_selected_bg_color; + border-radius:2px; +} + +.workingbg, #workingbg { + background-color:@theme_base_color; +} +.workingbg.view.cell:selected { + background-color:@theme_selected_bg_color; +} +.workingbg.view.cell:hover { + background-color:darker(@theme_selected_bg_color); + color:@theme_selected_text_color; + border-radius:3px; +} +.bkim { + transition: 200ms ease-out; + background-image: none; +} + + + diff --git a/ubl-settings-manager.desktop b/ubl-settings-manager.desktop new file mode 100644 index 0000000..6c60fcf --- /dev/null +++ b/ubl-settings-manager.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=ubl-settings-manager +Name[ru]=Настройки UBLinux +GenericName=ubl-settings-manager +GenericName[ru]=Настройки UBLinux +Comment=ubl-settings-manager +Comment[ru]=Приложение для управления настройками UBLinux +Type=Application +Exec=ubl-settings-manager +Icon=ubl-settings-manager +Terminal=false +X-XfcePluggable=false +Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings; diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade new file mode 100644 index 0000000..612a89d --- /dev/null +++ b/ubl-settings-manager.glade @@ -0,0 +1,2093 @@ + + + + + + + False + + + True + False + vertical + + + True + False + + + True + False + center + start + 20 + 20 + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + + + + True + False + center + start + 5 + 25 + 20 + 20 + You are not allowed to change theme on such low resolution! + True + 0.019999999552965164 + + + True + True + 1 + + + + + True + True + 0 + + + + + Understood + True + True + True + 5 + 5 + 5 + 5 + + + False + True + 2 + + + + + + + True + False + UBLinux Settings Manager + + + True + False + 32 + dialog-question-symbolic + 5 + + + + + + + True + False + False + 4 + + + True + False + Settings + True + + + + + + True + False + Documentation + True + + + + + + + False + 450 + 250 + dialog-question + + + True + False + vertical + + + 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? + 0 + + + + + + + False + True + 0 + + + + + True + False + start + start + 15 + 10 + You will be redirected to documentation website where documentation is translated and supported by community. + True + 0 + + + + True + True + 1 + + + + + Always redirect to online documentation + True + True + False + end + 5 + 10 + True + + + + False + True + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 30 + True + + + Cancel + True + True + True + + + + + True + True + 0 + + + + + Read Online + True + True + True + + + + + True + True + 1 + + + + + False + True + 1 + + + + + + + True + False + UBLinux Settings + + + True + False + 32 + dialog-question-symbolic + + + + + + + True + False + False + False + 4 + + + True + False + Settings + True + + + + + + True + False + Documentation + True + + + + + + + True + False + menu + + + True + False + + + + + True + False + + + + + True + False + True + + + + + 1 + 5 + 2 + 1 + 1 + + + False + 440 + 250 + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 2 + 0.019999999552965164 + in + + + True + False + 12 + + + True + False + + + True + False + vertical + + + True + False + 5 + 32x32 + + + False + True + 0 + + + + + True + True + 10 + 10 + 10 + 10 + adjustment1 + 5 + 0 + 0 + False + + + True + True + 1 + + + + + True + True + 0 + + + + + 64 + 64 + True + False + ru.ublinux.ubl-settings-manager + + + False + True + 1 + + + + + + + + + True + False + 5 + 5 + Icons size + + + + + True + True + 0 + + + + + True + False + 5 + 5 + 2 + 5 + 0.019999999552965164 + in + + + True + False + + + True + False + vertical + + + combo + True + False + center + 10 + 10 + 5 + True + 0 + + + True + True + 0 + + + + + + + + + True + False + 5 + 5 + Choose theme + + + + + True + True + 1 + + + + + button + True + True + True + 5 + 5 + 5 + 5 + + + False + True + 2 + + + + + True + False + + + True + False + 5 + 5 + 3 + 30 + True + + + Close + 200 + True + True + True + 2 + + + False + True + 0 + + + + + Save and apply + 200 + True + True + True + 2 + + + False + True + 1 + + + + + True + True + 0 + + + + + False + True + 4 + + + + + + + True + False + UBLinux Settings + + + True + False + 32 + ru.ublinux.ubl-settings-manager + 5 + + + + + + + 1 + 1 + 10 + + + + True + False + go-first-symbolic + + + False + 800 + 600 + ubconfig-gui + + + True + True + False + vertical + + + True + True + False + + + True + False + vertical + + + True + False + center + 3 + + + + False + True + 0 + + + + + + False + True + 0 + + + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + 5 + 5 + True + True + immediate + never + always + in + + + True + False + natural + + + True + False + vertical + 2 + + + + + + + + + + + True + True + 0 + + + + + True + True + 0 + + + + + False + vertical + + + + + + + False + True + 1 + + + + + + True + True + 1 + + + + + True + True + 0 + + + + + + + True + False + True + + + True + False + 32 + ru.ublinux.ubl-settings-manager + 5 + + + + + Back to settings + True + False + False + False + center + center + 10 + 10 + image1 + + + + 1 + + + + + True + False + center + center + vertical + + + + + + + 2 + + + + + True + False + vertical + + + True + True + False + True + center + center + MainMenu + none + False + + + + + + False + True + 0 + + + + + end + 3 + + + + + True + False + center + center + + + + + + + end + 4 + + + + + + + + True + False + 16 + software-remove-symbolic + + + True + False + ubconfig-gui + 6 + + + True + False + + + True + False + Element 1 + + + + + True + False + Element 2 + + + True + False + + + True + False + Element 3 + + + + + + + + + Element 4 + True + False + image3 + False + + + + + True + False + 16 + object-select-symbolic + + + False + 800 + 600 + + + True + False + vertical + + + True + True + 5 + 5 + 5 + 5 + in + + + True + False + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 3 + 3 + 5 + 5 + + + True + False + + + True + True + True + center + 3 + image2 + + + False + True + 0 + + + + + True + True + True + False + Section name + name + + + True + True + 1 + + + + + True + False + + + True + False + center + + + True + True + True + 5 + image4 + + + False + True + end + 2 + + + + + True + False + 2 + + + True + True + 5 + 5 + 5 + 10 + False + Identifier + + + True + True + 0 + + + + + True + True + 2 + + + + + True + True + 1 + + + + + True + True + 2 + + + + + + + + + + + + False + True + 1 + + + + + + + + + True + True + 0 + + + + + True + False + + + Close + True + True + True + 5 + 5 + + + False + True + end + 0 + + + + + Save and apply + True + True + True + 17 + 5 + + + False + True + end + 1 + + + + + False + True + 1 + + + + + + + True + False + UBLinux Settings + + + True + False + 32 + ru.ublinux.ubl-settings-manager + 5 + + + + + + + True + False + go-first-symbolic + + + False + 800 + 600 + ubconfig-gui + + + True + False + vertical + + + True + False + + + True + False + True + vertical + + + True + False + center + 3 + + + + False + True + 0 + + + + + + False + True + 0 + + + + + True + True + 52 + True + True + + + True + True + external + in + + + True + False + immediate + natural + + + True + False + vertical + + + + + + + + + + + False + True + + + + + True + False + vertical + + + True + False + vertical + + + True + False + 3 + 3 + 3 + 3 + 3 + 0 + in + + + True + False + 12 + + + True + False + center + center + + + + False + True + 0 + + + + + True + False + + + desklabel + True + False + center + right + 1 + + + False + True + 0 + + + + + False + True + 1 + + + + + + + + + + + + + True + True + 0 + + + + + True + True + 0 + + + + + True + False + vertical + + + False + vertical + + + + + + False + True + 0 + + + + + False + True + 1 + + + + + True + True + + + + + True + True + end + 1 + + + + + True + True + 0 + + + + + + + True + False + True + + + True + False + 32 + ru.ublinux.ubl-settings-manager + 5 + + + + + Back to settings + True + False + False + center + center + 10 + image5 + + + 1 + + + + + True + False + + + True + True + False + True + center + center + GnomeMenu + none + + + + + + + False + True + 0 + + + + + end + 2 + + + + + True + False + center + center + + + + + + end + 3 + + + + + True + False + center + center + vertical + + + + + + 4 + + + + + + + + + + + + + + Стандартная тема + + + GNOME тема + + + + + + + + + + + + + + + + + + + + + True + True + 4 + natural + horizontal + liststoreTemplate + 0 + 2 + 5 + True + + + 2 + + + 5 + 3 + 1 + 2 + 4 + + + + + 0 + word + 150 + + + 3 + 0 + + + + + + True + False + + + True + False + + + + + + + + + False + + + True + False + 0 + none + + + True + False + 5 + 5 + 5 + 5 + + + True + False + 4 + 4 + 4 + 4 + vertical + + + True + True + True + Settings + + + False + True + 3 + + + + + True + True + True + Documentation + + + False + True + 4 + + + + + True + True + True + About system + + + False + True + 5 + + + + + + + + + + + + + + + False + 800 + 600 + ubconfig-gui + + + True + False + vertical + + + True + False + + + True + False + vertical + + + True + False + center + 3 + + + + False + True + 0 + + + + + + False + True + 0 + + + + + True + False + vertical + + + Icon + True + False + 2 + 2 + 2 + 2 + 2 + 2 + + + True + True + in + + + True + False + natural + + + + + + + + + True + True + 0 + + + + + + True + True + 0 + + + + + True + False + vertical + + + + + + + False + True + 1 + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + + + True + False + + + True + False + True + + + True + False + UBLinux Settings Manager + + + True + True + 0 + + + + + True + True + False + True + menu1 + none + settingsPopover + + + + + + False + True + 1 + + + + + + + True + False + 32 + ru.ublinux.ubl-settings-manager + 5 + + + + + + + + False + + + True + False + 4 + 4 + 4 + 4 + 4 + 4 + vertical + + + True + True + True + Settings + + + False + True + 3 + + + + + True + True + True + Documentation + + + False + True + 4 + + + + + True + True + True + About system + + + False + True + 5 + + + + + + + + False + About + False + True + center + ubl-settings-manager + dialog + True + UBLinux Settings Manager + 1.6 + Copyright © 2022 - 2023 - UBSoft Software LLC + Settings manager for UBLinux + https://ublinux.ru/ + Project Home Page + UBGroup + UBGroup + ru.ublinux.ubl-settings-manager + gpl-2-0 + + + False + vertical + 2 + + + False + end + + + False + False + 0 + + + + + + + + + + False + + + True + False + vertical + + + True + False + + + True + False + start + 20 + 20 + 20 + 20 + True + dialog-question-symbolic + 6 + + + True + True + 0 + + + + + True + False + start + 10 + 15 + 20 + 20 + Looks like you don't have ubl-settings-info installed on your PC. + True + 0 + + + False + True + 1 + + + + + False + True + 0 + + + + + Ok + True + True + True + end + end + 5 + 5 + 5 + 5 + + + False + True + end + 1 + + + + + + + True + False + Warning + False + + + True + False + 32 + dialog-question-symbolic + + + + + + diff --git a/ubl-settings-manager.pot b/ubl-settings-manager.pot new file mode 100644 index 0000000..8681e7d --- /dev/null +++ b/ubl-settings-manager.pot @@ -0,0 +1,128 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-03-17 18:00+0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: source/ubl-settings-manager.c:632 +msgid "Settings manager for UBLinux" +msgstr "" + +#: source/ubl-settings-manager.c:633 source/ubl-settings-manager.c:1601 +#: source/ubl-settings-manager.c:1615 source/ubl-settings-manager.c:1674 +msgid "UBLinux Settings Manager" +msgstr "" + +#: source/ubl-settings-manager.c:636 +msgid "Project Home Page" +msgstr "" + +#: source/ubl-settings-manager.c:1600 +msgid "Back to all settings" +msgstr "" + +#: source/ubl-settings-manager.c:1675 +msgid "Icon size" +msgstr "" + +#: source/ubl-settings-manager.c:1676 +msgid "Window theme" +msgstr "" + +#: source/ubl-settings-manager.c:1677 +msgid "Would you like to read documentation in the Web?" +msgstr "" + +#: source/ubl-settings-manager.c:1678 +msgid "" +"You will be redirected to documentation site, where user help pages are " +"translated and supported by community." +msgstr "" + +#: source/ubl-settings-manager.c:1679 +msgid "Read online" +msgstr "" + +#: source/ubl-settings-manager.c:1680 +msgid "Cancel" +msgstr "" + +#: source/ubl-settings-manager.c:1681 +msgid "Close" +msgstr "" + +#: source/ubl-settings-manager.c:1682 +msgid "Save and apply" +msgstr "" + +#: source/ubl-settings-manager.c:1683 +msgid "Always redirect" +msgstr "" + +#: source/ubl-settings-manager.c:1684 +msgid "Settings" +msgstr "" + +#: source/ubl-settings-manager.c:1685 +msgid "About..." +msgstr "" + +#: source/ubl-settings-manager.c:1686 +msgid "Understood" +msgstr "" + +#: source/ubl-settings-manager.c:1687 +msgid "Sections management" +msgstr "" + +#: source/ubl-settings-manager.c:1792 +msgid "Standard theme" +msgstr "" + +#: source/ubl-settings-manager.c:1793 +msgid "GNOME theme" +msgstr "" + +#: source/ubl-settings-manager.h:8 +msgid "Version: " +msgstr "" + +#: source/ubl-settings-manager.h:9 +msgid "ubl-settings-manager version: " +msgstr "" + +#: source/ubl-settings-manager.h:9 +msgid "" +"\n" +"GTK settings manager for UBLinux\n" +"Usage: ubl-settings-manager [OPTIONS...]\n" +"Options:\n" +" -h, --help\t\t Show this help\n" +" -V, --version\t \t Show package version\n" +" --lock-settings Lock menu settings\n" +msgstr "" + +msgid "Personal" +msgstr "" + +msgid "Hardware" +msgstr "" + +msgid "System" +msgstr "" + +msgid "Misc" +msgstr "" diff --git a/ubl-settings-manager_ru.po b/ubl-settings-manager_ru.po new file mode 100644 index 0000000..15e3a47 --- /dev/null +++ b/ubl-settings-manager_ru.po @@ -0,0 +1,135 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "translateinfo\n" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-03-16 12:28+0600\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: source/ubl-settings-manager.c:724 +msgid "Settings manager for UBLinux" +msgstr "Менеджер настроек для UBLinux" + +#: source/ubl-settings-manager.c:725 source/ubl-settings-manager.c:1584 +#: source/ubl-settings-manager.c:1598 source/ubl-settings-manager.c:1657 +msgid "UBLinux Settings Manager" +msgstr "Настройки UBLinux" + +#: source/ubl-settings-manager.c:728 +msgid "Project Home Page" +msgstr "Домашняя страница проекта" + +#: source/ubl-settings-manager.c:1583 +msgid "Back to all settings" +msgstr "Назад ко всем настройкам" + +#: source/ubl-settings-manager.c:1658 +msgid "Icon size" +msgstr "Размер иконок" + +#: source/ubl-settings-manager.c:1659 +msgid "Window theme" +msgstr "Выбор темы" + +#: source/ubl-settings-manager.c:1660 +msgid "Would you like to read documentation in the Web?" +msgstr "Вы хотите прочитать документацию в Сети?" + +#: source/ubl-settings-manager.c:1661 +msgid "" +"You will be redirected to documentation site, where user help pages are " +"translated and supported by community." +msgstr "Вы будете перенаправлены на сайт с документацией где страницы помощи переводятся и поддерживаются сообществом." + +#: source/ubl-settings-manager.c:1662 +msgid "Read online" +msgstr "Прочитать онлайн" + +#: source/ubl-settings-manager.c:1663 +msgid "Cancel" +msgstr "Отменить" + +#: source/ubl-settings-manager.c:1664 +msgid "Close" +msgstr "Закрыть" + +#: source/ubl-settings-manager.c:1665 +msgid "Save and apply" +msgstr "Сохранить и применить" + +#: source/ubl-settings-manager.c:1666 +msgid "Always redirect" +msgstr "Всегда перенаправлять" + +#: source/ubl-settings-manager.c:1667 +msgid "Settings" +msgstr "Настройки" + +#: source/ubl-settings-manager.c:1668 +msgid "About..." +msgstr "О программе" + +#: source/ubl-settings-manager.c:1669 +msgid "Understood" +msgstr "Понятно" + +#: source/ubl-settings-manager.c:1670 +msgid "Sections management" +msgstr "Настройка разделов" + +#: source/ubl-settings-manager.c:1768 +msgid "Standard theme" +msgstr "Стандартная тема" + +#: source/ubl-settings-manager.c:1769 +msgid "GNOME theme" +msgstr "GNOME тема" + +#: source/ubl-settings-manager.h:8 +msgid "Version: " +msgstr "Версия: " + +#: source/ubl-settings-manager.h:8 +msgid "ubl-settings-manager version: " +msgstr "ubl-settings-manager версия: " + +#: source/ubl-settings-manager.h:8 +msgid "" +"\n" +"GTK settings manager for UBLinux\n" +"Usage: ubl-settings-manager [OPTIONS...]\n" +"Options:\n" +" -h, --help\t\t Show this help\n" +" -V, --version\t \t Show package version\n" +" --lock-settings Lock menu settings\n" +msgstr "" +"\n" +"GTK Менеджер настроек для UBLinux\n" +"Использование: ubl-settings-manager [АРГУМЕНТЫ...]\n" +"Аргументы:\n" +" -h, --help\t\t Показать помощь\n" +" -V, --version\t \t Показать версию пакета\n" +" --lock-settings \t Заблокировать окно настроек\n" + +msgid "Personal" +msgstr "Личные" + +msgid "Hardware" +msgstr "Оборудование" + +msgid "System" +msgstr "Система" + +msgid "Misc" +msgstr "Прочее" diff --git a/ublinux-logo.svg b/ublinux-logo.svg new file mode 100644 index 0000000..d44113c --- /dev/null +++ b/ublinux-logo.svg @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +