Merge pull request 'master' (#61) from YanTheKaller/ubl-settings-resourcequota:master into master

Reviewed-on: #61
master
Dmitry Razumov 1 month ago
commit 4f16249e7f

@ -12,7 +12,7 @@ DEPENDS = /bin/cmake
PREFIX ?= /usr/local
PKGNAME = $(MAKEFILE_DIR)
FILE_VER = source/${PKGNAME}.h
PKGIDENT = $(subst /,-,$(subst /usr,,${PREFIX}))
PKGIDENT=$(subst /,-,${PREFIX})
default_target: all
@ -94,7 +94,6 @@ uninstall:
done
@$(RM) "${DESTDIR}${PREFIX}/bin/${PKGNAME}"
@$(RM) "${DESTDIR}${PREFIX}/share/applications/${PKGNAME}.desktop"
@$(RM) "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/com.ublinux.${PKGNAME}.svg"
@$(RM) "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy"
@if [ -z ${DESTDIR} ]; then \
[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
@ -117,18 +116,19 @@ install: check uninstall
install -dm755 "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps"; \
rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
done
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.funnel-symbolic.svg"
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg"
@cp ./com.ublinux.${PKGNAME}.policy ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy
@sed -e 's+/usr/bin+${PREFIX}/bin+' -e 's+.run+${PKGIDENT}.run+g' ./compile/com.ublinux.${PKGNAME}${PKGIDENT}.policy -i
@install -Dm755 -t "${DESTDIR}${PREFIX}/bin/" "${CMAKE_BUILD_DIR}/${PKGNAME}"
@install -Dm644 "com.ublinux.${PKGNAME}.policy" "${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy"
@sed -e '\|annotate key=|s|/usr/bin|${PREFIX}/bin|' -e '/action id=/s/\.run/${PKGIDENT}\.run/' -i ${DESTDIR}/usr/share/polkit-1/actions/com.ublinux.${PKGNAME}${PKGIDENT}.policy
@install -Dm644 -t "${DESTDIR}${PREFIX}/share/applications/" "${PKGNAME}.desktop"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg"
@install -Dm644 -t "${DESTDIR}/usr/share/polkit-1/actions/" "${CMAKE_BUILD_DIR}/com.ublinux.${PKGNAME}${PKGIDENT}.policy"
@ldconfig -n /usr/local/lib
@if [ -z ${DESTDIR} ]; then \
[ -d "${DESTDIR}${PREFIX}/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
[ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}/usr/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \
[ -d "${DESTDIR}${PREFIX}/share/applications" ] && touch "${DESTDIR}${PREFIX}/share/applications" &>/dev/null || true; \
[ -d "${DESTDIR}/usr/share/applications" ] && touch "${DESTDIR}/usr/share/applications" &>/dev/null || true; \
fi
@echo "Install: OK"
@ -147,7 +147,7 @@ help:
echo "... init"; \
echo "... debug"; \
echo "... prepare"; \
echo "... build"; \
echo "... compile"; \
echo "... install"; \
echo "... uninstall"; \
echo "... clean"
echo "... clean"

@ -24,10 +24,6 @@ if(WEBKIT_LIBRARIES_FOUND)
add_definitions(${WEBKIT_CFLAGS_OTHER})
endif()
configure_file(ubl-cmake.in ubl-cmake.h)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h DESTINATION ./)
set(GRESOURCE_C resources.c)
set(GRESOURCE_XML gresource.xml)
@ -63,27 +59,33 @@ add_custom_target(
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -std=c++2a")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always -lm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
add_definitions(-DVTE_INCLUDE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \
-O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection")
string(FIND "${CMAKE_CXX_FLAGS}" "-D_FORTIFY_SOURCE" FORTIFY_FOUND)
if(FORTIFY_FOUND EQUAL -1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
endif()
set(SOURCE_FILES
ubl-settings-resourcequota.c
ubl-settings-resourcequota.h
ubl-utils.c
ubl-utils.h
${CMAKE_CURRENT_BINARY_DIR}/ubl-cmake.h
ubl-strings.h
)
set(LIBRARIES
${GTK_LIBRARIES}
${WEBKIT_LIBRARIES}
${VTE291_LIBRARIES}
pthread)
${UTILS_LIBRARIES}
${VTE291_LIBRARIES}
ublsettings
ublsettings-gtk3
ublsettingsui-gtk3)
add_executable(${PROJECT_NAME} ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C})

@ -1 +0,0 @@
#cmakedefine WEBKIT_FOUND

File diff suppressed because it is too large Load Diff

@ -1,6 +1,8 @@
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include "ubl-utils.h"
#include "libublsettings.h"
#include "libublsettings-gtk3.h"
#include "libublsettingsui-gtk3.h"
#include <locale.h>
#include <stdio.h>
#include <unistd.h>
@ -9,7 +11,6 @@
#include <getopt.h>
#include <libintl.h>
#include <vte/vte.h>
#include "ubl-cmake.h"
#include "sys/sysinfo.h"
#ifdef WEBKIT_FOUND
@ -30,41 +31,45 @@
#define LocalePath "/usr/share/locale"
#define LocaleName "ubl-settings-resourcequota"
#define load_global_command "ubconfig --default --source global get security CGROUP_QUOTA[*]"
#define load_local_command "ubconfig --default --source system get security CGROUP_QUOTA[*]"
#define save_global_command "ubconfig --default --target global set security"
#define save_local_command "ubconfig --default --target system set security"
#define save_command "ubconfig set security "
#define remove_command "ubconfig remove security "
#define remove_global_command "ubconfig --target global --noexecute remove security "
#define remove_local_command "ubconfig --target system remove security "
// #define load_global_command "ubconfig --default --source global get security CGROUP_QUOTA[*]"
// #define load_local_command "ubconfig --default --source system get security CGROUP_QUOTA[*]"
// #define save_global_command "ubconfig --default --target global set security"
// #define save_local_command "ubconfig --default --target system set security"
// #define save_command "ubconfig set security "
// #define remove_command "ubconfig remove security "
// #define remove_global_command "ubconfig --target global --noexecute remove security "
// #define remove_local_command "ubconfig --target system remove security "
#define get_devices_command "findmnt -lo source,target,fstype,label,size -t ext4 |grep -vE \"zram|\\]|\\[|SOURCE\""
#define get_processes_tree_command "clear; systemd-cgls --no-page"
#define get_dispatcher_command "systemd-cgtop"
#define get_dispatcher_command "clear; systemd-cgtop"
#define get_information_command "systemctl status "
#define get_processes_command "systemd-cgls --no-pager |grep -oE \"[-0-9A-Za-z.:]{1,}.service\""
#define get_slices_command "systemd-cgls --no-pager |grep -oE \"[-0-9A-Za-z.:]{1,}.slice\""
#define yon_config_get_custom_command(target) yon_char_unite("ubconfig --source ",target," get security CGROUP_QUOTA[*]",NULL)
#define config_get_local_command "ubconfig --default --source system get security CGROUP_QUOTA[*]"
#define config_get_global_command "ubconfig --default --source global get security CGROUP_QUOTA[*]"
#define config_get_default_command ""
#define config_get_global_only_parameters ""
#define config_get_local_only_parameters ""
#define CGROUP_QUOTA(name) yon_char_unite("CGROUP_QUOTA[",name,"]",NULL)
#define CGROUP_QUOTA_comd(name) yon_char_unite("ubconfig -- source global get security CGROUP_QUOTA[",target,"]",NULL)
#define CGROUP_QUOTA_parameter "CGROUP_QUOTA"
#define CGROUP_QUOTA_command "ubconfig -- source global get security CGROUP_QUOTA"
typedef char *string;
string version_application;
char *local;
__attribute__((unused)) static \
string version_application;
typedef struct {
int always_open_documentation;
int win_pos_x;
int win_pos_y;
int win_width;
int win_height;
int socket_id;
int load_socket_id;
int save_socket_id;
int lock_help;
int lock_save_local;
int lock_save_global;
int lock_load_global;
template_config_fields
int save_config;
config_str launch_arguments;
int launch_size;
GtkListStore *list;
long avaliable_ram;
long avaliable_swap;
@ -81,34 +86,7 @@ typedef struct {
} config;
typedef struct {
//Standard
GtkWidget *Window;
GtkWidget *HatLabel;
GtkWidget *PlugBox;
GtkWidget *HeadOverlay;
GtkWidget *HeadImage;
GtkWidget *HeadBox;
GtkWidget *HeadTitleLabel;
GtkWidget *HeadInfoLabel;
GtkWidget *StatusBox;
GtkWidget *StatusIcon;
GtkWidget *StatusLabel;
GtkWidget *SaveLabel;
GtkWidget *SaveMenuItem;
GtkWidget *SaveGlobalMenuItem;
GtkWidget *SaveLocalMenuItem;
GtkWidget *RightBox;
GtkWidget *LoadLabel;
GtkWidget *LoadGlobalMenuItem;
GtkWidget *LoadLocalMenuItem;
GtkWidget *LeftBox;
GtkWidget *DocumentationMenuItem;
GtkWidget *AboutMenuItem;
template_window_fields
// Custom
GtkWidget *FiltersButton;
GtkWidget *InformationButton;
@ -202,4 +180,43 @@ typedef struct {
char *write;
} device_limits;
main_window *setup_window();
main_window *setup_window();
void on_save_done(main_window *, config_str output, int size);
char *get_size_mod(GtkComboBox *combo);
void yon_main_window_complete(main_window *widgets);
void config_init();
void on_info_target_type_switched(GtkWidget *self, main_window *widgets);
void on_tab_changed(GtkWidget *self, GtkWidget *page, int page_num, main_window *widgets);
void on_processes_update(GtkWidget *self,main_window *widgets);
void on_dispatcher_update(GtkWidget *self,main_window *widgets);
void on_edit_open(GtkWidget *self, main_window *widgets);
void on_quotas_edit(GtkWidget *self, dictionary *windows);
void on_remove(GtkWidget *self, main_window *widgets);
void on_information_update(GtkWidget *self, main_window *widgets);
void on_information(GtkWidget *self, main_window *widgets);
void on_information_chosen_changed(GtkWidget *self, main_window *widgets);
void on_add_open(GtkWidget *self, main_window *widgets);
void on_filters_opened(GtkWidget *self, main_window *widgets);
void on_quota_manual_input_focus (GtkWidget *self, GdkEventFocus *event, quota_window *window);
void on_quota_manual_input(GtkWidget *self, quota_window *window);
void on_apply_filters(GtkWidget *self, dictionary *dict);
void yon_load_proceed(YON_CONFIG_TYPE type);
void on_config_custom_load(GtkWidget *,main_window *widgets);
void on_config_global_load(GtkWidget *,main_window *widgets);
void on_config_local_load(GtkWidget *,main_window *widgets);
void on_config_custom_save(GtkWidget *, main_window *);
void on_config_global_save(GtkWidget *, main_window *);
void on_config_local_save(GtkWidget *, main_window *);
void on_config_global_local_save(GtkWidget *, main_window *);
void yon_interface_update(main_window *);
int yon_get_size_request_from_letter(char size);
void on_quotas_save(GtkWidget *self, dictionary *windows);
void on_device_current_changed(GtkWidget *self, quota_window *window);
void yon_get_devices(quota_window *window);
void on_target_check_chosen(GtkWidget *self, quota_window *window);
void on_quota_target_type_changed(GtkWidget *self, quota_window *window);
void on_check_maximum_cpu(GtkWidget *self, GtkWidget *pair);
void on_check_maximum(GtkWidget *self, GtkWidget *pair);
void on_limit_manual_input(GtkWidget *self, double *new_value, quota_window *window);
void on_quota_configuration_update(GtkWidget *self, quota_window *window);
void on_device_limits_update(GtkWidget *, quota_window *window);

@ -1,28 +1,28 @@
#define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL)
#define HELP_LABEL yon_char_unite(_("ubl-settings-resourcequota version:")," ", version_application,"\n",_("CPU and RAM quotas"),"\n",_("Usage:"), " ubl-settings-resourcequota ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n",NULL)
#define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked")
// #define VERSION_LABEL yon_char_unite(_("Version:")," ",version_application,"\n",NULL)
// #define HELP_LABEL yon_char_unite(_("ubl-settings-resourcequota version:")," ", version_application,"\n",_("CPU and RAM quotas"),"\n",_("Usage:"), " ubl-settings-resourcequota ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n",NULL)
// #define ROOT_WARNING_LABEL _("Warning! Application was launched without root - root-dependent actions are locked")
#define TITLE_LABEL _("CPU and RAM quotas")
#define TITLE_INFO_LABEL _("Configuring CPU and RAM quota settings for groups and users of the system")
#define SUCCESS_LABEL _("Operation succeeded")
#define ABOUT_LABEL _("About")
#define DOCUMENTATION_LABEL _("Documentation")
#define SAVE_LOCAL_LABEL _("Save to local configuration")
#define SAVE_GLOBAL_LABEL _("Save to global configuration")
#define SAVE_CONFIGURATION_LABEL _("Save configuration")
#define SAVE_LABEL _("Save")
#define LOAD_LOCAL_LABEL _("Load local configuration")
#define LOAD_GLOBAL_LABEL _("Load global configuration")
#define LOAD_LABEL _("Load")
#define LOAD_LABEL _("Load")
#define CANCEL_LABEL _("Cancel")
#define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?")
#define HELP_INFO_LABEL _("You will be redirected to documentation website, where documentation is\ntranslated and supported by community.")
#define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation")
#define OPEN_HELP_LABEL _("Open documentation")
#define PROJECT_HOME_LABEL _("Project homepage")
// #define SUCCESS_LABEL _("Operation succeeded")
// #define ABOUT_LABEL _("About")
// #define DOCUMENTATION_LABEL _("Documentation")
// #define SAVE_LOCAL_LABEL _("Save to local configuration")
// #define SAVE_GLOBAL_LABEL _("Save to global configuration")
// #define SAVE_CONFIGURATION_LABEL _("Save configuration")
// #define SAVE_LABEL _("Save")
// #define LOAD_LOCAL_LABEL _("Load local configuration")
// #define LOAD_GLOBAL_LABEL _("Load global configuration")
// #define LOAD_LABEL _("Load")
// #define LOAD_LABEL _("Load")
// #define CANCEL_LABEL _("Cancel")
// #define HELP_TITLE_LABEL _("Would you like to read documentation in the Web?")
// #define HELP_INFO_LABEL _("You will be redirected to documentation website, where documentation is\ntranslated and supported by community.")
// #define HELP_ALWAYS_OPEN_LABEL _("Always redirect to online documentation")
// #define OPEN_HELP_LABEL _("Open documentation")
// #define PROJECT_HOME_LABEL _("Project homepage")
#define NOTHING_CHOSEN_LABEL _("Nothing were chosen")
#define STR_USER _("User")
@ -64,7 +64,7 @@
#define WRITE_LIMIT_TAB_LABEL _("I/O\nlimit\n(write)")
#define QUOTA_OBJECT_LABEL _("Quota target")
#define SOFT_LIMIT_LABEL _("Soft RAM limit, n(volume)")
#define SOFT_LIMIT_LABEL _("Soft RAM limit, (volume)")
#define HARD_LIMIT_LABEL _("Hard RAM limit, (volume)")
#define SWAP_LIMIT_LABEL _("Swap file limit (volume)")
#define CPU_LIMIT_LABEL _("CPU limit (%)")
@ -100,4 +100,6 @@
#define READ_LABEL _("Read")
#define WRITE_LABEL _("Write")
#define APPLY_CHANGES_LABEL _("Apply changes of operations limit")
#define MANUAL_INPUT_LABEL _("Manual input (for advanced users)")
#define MANUAL_INPUT_LABEL _("Manual input (for advanced users)")
#define OPERATION_FAILED_EMPTY_LABEL _("Current quota has no parameters")

File diff suppressed because it is too large Load Diff

@ -1,366 +0,0 @@
#ifndef UBL_UTILS
#define UBL_UTILS
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <pthread.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
#include <locale.h>
#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include <pwd.h>
#include <vte/vte.h>
#include "ubl-cmake.h"
#ifdef WEBKIT_FOUND
#include <webkit2/webkit2.h>
#endif
#define DesktopPath "/usr/share/applications/"
#define try bool __HadError=false;
#define catch(x) ExitJmp:if(__HadError)
#define throw(x) {__HadError=true;goto ExitJmp;}
static char** array_size_pow;
#define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next)
#define new(type) malloc(sizeof(type))
#define new_arr(type,size) malloc(sizeof(type)*size)
#define get_home_dir_command yon_char_unite("getent passwd \"",yon_ubl_root_user_get(),"\" | cut -d: -f6",NULL)
#define get_processes_command "systemd-cgls --no-pager |grep -oE \"[-0-9A-Za-z.:]{1,}.service\""
#define get_slices_command "systemd-cgls --no-pager |grep -oE \"[-0-9A-Za-z.:]{1,}.slice\""
typedef enum
{
#ifdef __GTK_H__
DICTIONARY_GTK_WIDGETS_TYPE,
#endif
DICTIONARY_OTHER_TYPE=0,
DICTIONARY_CHAR_TYPE,
DICTIONARY_INT_TYPE,
DICTIONARY_BOOL_TYPE,
} DICT_TYPE;
typedef struct dictionary
{
char *key;
void *data;
struct dictionary *next;
struct dictionary *prev;
struct dictionary *first;
DICT_TYPE data_type;
int flag1;
} dictionary;
typedef struct apps
{
char *Name;
int Type;
char *Categories;
char *Exec;
char *Icon;
int Pluggable;
int DualPluggable;
} apps;
typedef char** config_str;
static dictionary *__yon__config__strings = NULL;
#define check_config if(__yon__config__strings&&__yon__config__strings->data_type==DICTIONARY_CHAR_TYPE)
#define config(key) yon_config_get_by_key(key)
#define for_config dictionary temp = NULL; for_dictionary(temp,__yon__config__strings)
#define yon_remalloc(pointer, size) (!pointer) ? malloc(size) : realloc(pointer, size)
// dictionary functions
/**yon_dictionary_get_data(dictionary, type)
* [EN]
* Gets data from dictionary.
* [dictionary] is dictionary, from which data should be extracted;
* [type] is type of data, [dictionary] contains.
* [RU]
* Возвращает данные из словаря.
* [dictionary] - словарь из которого достаются данные.
* [type] - тип данных, хранящихся в словаре [dictionary].
*/
#define yon_dictionary_get_data(dictionary, type) ((type)dictionary->data)
/**yon_dictionary_add_or_create_if_exists_with_data(dict,key,data)
* [EN]
*
* [RU]
* Добавляет элемент словаря в конец словаря [dict] c ключом [key] и данными [data].
* Если словарь не существует, создаёт его
*/
#define yon_dictionary_add_or_create_if_exists_with_data(dict,key,data) {if (!dict) dict=yon_dictionary_new_with_data(key,data); \
else dict=yon_dictionary_append_with_data(dict,key,data);}
dictionary *yon_dictionary_new();
dictionary *yon_dictionary_append(dictionary *targetdict);
dictionary *yon_dictionary_get_last(dictionary *dict);
dictionary *yon_dictionary_swap(dictionary *dict, int aim);
void yon_dictionary_make_first(dictionary *dict);
void yon_dictionary_make_nth(dictionary *dict, int nth);
dictionary *yon_dictionary_new_with_data(char *key, void *data);
dictionary *yon_dictionary_append_with_data(dictionary *dict, char *key, void *data);
dictionary *yon_dictionary_connect(dictionary *old, dictionary *toconnect);
dictionary *yon_dictionary_get(dictionary **dict, char *key);
dictionary *yon_dictionary_rip(dictionary *dict);
dictionary *yon_dictionary_get_nth(dictionary *dict, int place);
void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(void*));
// char functions
int yon_char_find_last(char *source, char find);
char *yon_char_append(char *source, char *append);
char *yon_char_new(char *chr);
char *yon_char_unite(char *source, ...);
char *yon_cut(char *source, int size, int startpos);
char *yon_char_divide(char *source, int dividepos);
char *yon_char_divide_search(char *source, char *dividepos, int delete_divider);
char *yon_char_from_int(int int_to_convert);
char *yon_char_from_long(long int_to_convert);
char *yon_char_replace(char *source, char *find, char*replace);
char **yon_char_parse(char *parameters, int *size, char *divider);
char **yon_char_parsed_rip(char **char_string, int *size, int item_to_delete);
int yon_char_parsed_check_exist(char **parameters, int size, char *param);
int yon_char_find_count(char *source, char *find);
int yon_char_parsed_includes_char_parsed (config_str source, config_str to_check, int source_size, int check_size);
config_str yon_char_parsed_new (int *size, ...);
void yon_char_parsed_copy(config_str *source, config_str *to_copy);
config_str yon_char_parsed_append(config_str parsed, int *size, char *string);
int yon_char_parsed_remove_newline_symbols(config_str parsed, int *size);
int yon_ubl_check_root();
char *yon_ubl_root_user_get();
char *yon_ubl_user_get_home_directory();
config_str yon_ubl_get_all_users(int *user_size);
config_str yon_ubl_get_all_processes(int *processes_size);
config_str yon_ubl_get_all_slices(int *slices_size);
// parsing functions
config_str philos_list_user(int* size);
apps *yon_apps_scan_and_parse_desktops(int *sizef);
void yon_apps_sort(apps *applist, int size);
apps *yon_apps_get_by_name(apps *applist, char *name, int size);
config_str yon_config_load(char *command, int *str_len);
int yon_config_save_registered(char *path, char *section);
char *yon_config_get_parameter(config_str parameters, int size, char *param);
int yon_config_load_register(char *command);
int yon_config_remove_by_key(char *key);
int yon_config_remove_by_data(void *data);
int yon_config_remove_element(char *key, char *deleted);
void *yon_config_get_by_key(char *key);
char *yon_config_get_key_by_data(char *data);
int yon_config_set(char *key, void *data);
int yon_config_clean();
void yon_config_register(char *key, void *data);
config_str yon_config_get_all();
// terminal-using functions
int yon_launch_app_with_arguments(char *name, char *args);
void yon_launch(char *command);
// Gtk functions
#ifdef __GTK_H__
#ifdef VTE_TERMINAL
void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, void *endwork_function, void* endwork_function_argument);
void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *endwork_function, void* endwork_function_argument);
#endif
enum YON_TYPE{
YON_TYPE_STRING,
YON_TYPE_STRING_LIST,
YON_TYPE_INT,
YON_TYPE_DOUBLE,
YON_TYPE_BOOLEAN,
YON_TYPE_OTHER
};
GtkWidget *yon_ubl_menu_item_about_new(char *buttonname);
GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname);
/**yon_gtk_builder_get_widget(builder, widget_name)
* [EN]
* Returns GtkWidget from GtkBuilder *[builder].
* [builder] is GtkBuilder*;
* [widget_name] is id of widget;
*/
#define yon_gtk_builder_get_widget(builder, widget_name) GTK_WIDGET(gtk_builder_get_object(builder, widget_name))
typedef struct
{
GtkWidget *Icon;
GtkWidget *Label;
GtkWidget *IconView;
GtkListStore *List;
} expander_icon_view;
void yon_window_config_setup(GtkWindow *window);
int yon_window_config_load(char *path);
config_str yon_window_config_get_section(char *section, gsize *size);
void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type);
void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type);
void yon_window_config_erase_custom_parameter(char *param_name, char *section);
int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type);
int yon_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size);
int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find);
int yon_gtk_icon_view_hide_empty(dictionary *icon_view_segment);
int yon_dictionary_gtk_pack_start_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...);
int yon_dictionary_gtk_pack_end_multiple_widgets(GtkBox *destination, gboolean expand, gboolean fill, int padding, ...);
void yon_gtk_widget_set_sensitive_from_toggle_button(GtkToggleButton *toggle, GtkWidget *target);
void yon_gtk_widget_set_sensitive_from_toggle_button_inversed(GtkToggleButton *toggle, GtkWidget *target);
void yon_gtk_widget_set_sensitive_from_combo_box(GtkComboBox *toggle, GtkWidget *target);
void yon_gtk_widget_set_sensitive_from_combo_box_inversed(GtkComboBox *toggle, GtkWidget *target);
typedef enum
{
BACKGROUND_IMAGE_SUCCESS_TYPE,
BACKGROUND_IMAGE_FAIL_TYPE
} BACKGROUND_IMAGE_TYPE;
typedef struct {
BACKGROUND_IMAGE_TYPE type;
GtkWidget *icon;
GtkWidget *box;
GtkWidget *label;
char* text_to_render;
} render_data;
/**yon_ubl_status_box_setup(render,icon,box,label)
* [EN]
* Sets up [render] structure of type render_data.
* [icon] is GtkImage widget of status box for showing status icons;
* [box] is GtkBox widget of status box for showing status color;
* [label] is GtkLabel widget of status box for showing status text;
* [RU]
* Настраивает структуру [render] типа render_data.
* [icon] - виджет типа GtkIcon в котором будут отображаться статусные иконки;
* [box] - виджет типа GtkBox в котором будет отображаться цвет статуса;
* [label] - виджет типа GtkLabel в котором будет отображаться текст статусного сообщения;
*/
int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label);
/**yon_ubl_status_box_render(render,text,type)
* [EN]
* Renders message in status box;
* [render] is render_data structure of status box;
* [text] is text to be shown in status box;
* [type] if type of message. Can be BACKGROUND_IMAGE_FAIL_TYPE or BACKGROUND_IMAGE_SUCCESS_TYPE
* [RU]
* Отображает сообщение в статусном окне.
* [render] - структура типа render_data для нужного статусного окна;
* [text] - текст, отображаемый в статусном окне;
* [type] - тип сообщения. Может быть:
* BACKGROUND_IMAGE_FAIL_TYPE (красный фон,иконка - восклицательный знак)
* или
* BACKGROUND_IMAGE_SUCCESS_TYPE (Жёлтный фон, иконка - галка)
*/
void yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type);
/**yon_ubl_header_setup(overlay, head, image, imag_path)
* [EN]
* Sets up header of app.
* [overlay] is overlay for app header;
* [head] is box of header, which connects to [overlay]
* [image] is header background image;
* [imag_path] is path of image, shown in [image]
* [RU]
* Настраивает заголовок приложения.
* [overlay] - оверлей заголовка приложения;
* [head] - шапка заголовка, присоединяемая к [overlay]
* [image] - виджет картинки для заднего фона;
* [imag_path] - путь до картинки, загружаемой в [image]
*/
#define yon_ubl_header_setup(overlay, head, image, imag_path) _yon_ubl_header_setup(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path)
#define yon_ubl_header_setup_resource(overlay, head, image, imag_path) _yon_ubl_header_setup_resource(GTK_WIDGET(overlay), GTK_WIDGET(head), GTK_WIDGET(image), (char *)imag_path)
#endif
void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path);
void _yon_ubl_header_setup_resource(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path);
void yon_ubl_setup_sockets(GtkWidget *main_window, GtkWidget *left_window, GtkWidget *right_window, int socket_main_id, int socket_left_id, int socket_right_id);
#ifdef WEBKIT_FOUND
void yon_ubl_browser_window_open(char *link, char *browser_window_name);
#else
void yon_ubl_browser_window_open(char *link, char *browser_window_name);
#endif
#endif

@ -178,11 +178,13 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
@ -269,6 +271,7 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
@ -600,6 +603,7 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="spacing">5</property>
<child>
<object class="GtkBox" id="box2">
@ -624,6 +628,7 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="spacing">5</property>
<child>
<object class="GtkCheckButton" id="DeviceLimitReadCheck">
@ -715,6 +720,7 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">start</property>
<property name="spacing">5</property>
<child>
<object class="GtkCheckButton" id="DeviceLimitWriteCheck">

File diff suppressed because it is too large Load Diff

@ -284,7 +284,7 @@ msgid "Quota target"
msgstr ""
#: source/ubl-strings.h:67
msgid "Soft RAM limit, n(volume)"
msgid "Soft RAM limit, (volume)"
msgstr ""
#: source/ubl-strings.h:68

@ -115,7 +115,7 @@ msgstr "Сохранить"
#: source/ubl-strings.h:14
msgid "Load local configuration"
msgstr "Загрузить локальную конфигуруцию"
msgstr "Загрузить локальную конфигурацию"
#: source/ubl-strings.h:15
msgid "Load global configuration"
@ -309,7 +309,7 @@ msgstr "Объект квотирования"
#: source/ubl-strings.h:67
#, fuzzy
msgid "Soft RAM limit, n(volume)"
msgid "Soft RAM limit, (volume)"
msgstr "Мягкий лимит ОЗУ, (объём)"
#: source/ubl-strings.h:68

Loading…
Cancel
Save