diff --git a/.install.sh b/.install.sh new file mode 100755 index 0000000..6541750 --- /dev/null +++ b/.install.sh @@ -0,0 +1,6 @@ +make +gcc compile/resources.c source/my_device.c source/philos_utils.c source/philos_utils.h source/my_device.h source/filters.c source/filters.h source/ubl-cmake.h source/view_edit.h source/view_edit.c source/view_add.h source/view_add.c source/ubl-utils.h source/ubl-utils.c source/ubl-strings.h source/ubl-settings-resourcequota.h source/ubl-settings-resourcequota.c -o ubl-settings-resourcequota `pkg-config --cflags --libs gtk+-3.0 vte-2.91 webkit2gtk-4.0 webkit2gtk-web-extension-4.0` -g +sudo make install clean +cd ./terminal-commands +make +cd ../ diff --git a/source/philos_utils.h b/source/philos_utils.h index 8ec5af6..4fc2a97 100644 --- a/source/philos_utils.h +++ b/source/philos_utils.h @@ -66,6 +66,7 @@ typedef struct { GtkWidget* cbxTempQuotaObj; GtkWidget* cbxTempQuotaLevel2; GtkWidget* boxBlockGui; + GtkWidget* lblInfoObjQuotas; } temp_set_window; void philos_array_string_remove_char(char*** array, char* str_remove, int size); void philos_set_pow_size_memory(char* str_find, int** array_size,int index, char** array_size_pow); diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index 45ba5ff..89ae76f 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -671,6 +671,8 @@ void tree_view_add(int index) { main_config.cpu_limit[index] = add_get_limit_cpu(); main_config.soft_raw_limit_size[index] = add_get_soft_size(); main_config.hard_raw_limit_size[index] = add_get_hard_size(); + main_config.quota_volume_size[index] = add_get_index_volume_quota(); + main_config.type_quota_size[index] = add_get_index_type_quota(); main_config.swap_size[index] = add_get_limit_swap_size(); main_config.cpu_limit_size[index] = add_get_limit_cpu_size(); philos_free_string_array(&main_config.disk_read[index],(get_device_cfg()->size_disk*2)); @@ -844,9 +846,10 @@ void info_show(GtkWidget *self) { char* str_iter = gtk_tree_model_get_string_from_iter(model, &iter); int index = atoi(str_iter); char* t_quota = main_config.type_quota[index]; - if (yon_char_find_count(t_quota, "-") == 0) { - } + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cbtMainInfo), main_config.type_quota_size[index]); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->cbtMainInfoLevel2), main_config.quota_volume_size[index]); } + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->notebookMain), 3); } @@ -929,6 +932,7 @@ void wrapper_edit_show() { edit_set_limit_cpu(main_config.cpu_limit[index], main_config.cpu_limit_size[index]); edit_set_soft(main_config.soft_raw_limit[index], main_config.soft_raw_limit_size[index]); edit_set_limit_swap(main_config.swap[index], main_config.swap_size[index]); + edit_temp_set_obj_quota(main_config.type_quota[index], main_config.quota_volume[index]); set_gui_device(); edit_event(get_widget_edit()); g_signal_connect(G_OBJECT(get_widget_edit()->btnSaveTempSave), "clicked", G_CALLBACK(main_edit_btn_save), NULL); @@ -1259,7 +1263,7 @@ int main(int argc, char *argv[]){ array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_TB); int option_index=0; int show_help=0; - { + { struct option long_options[] = { {"help", 0, 0, 'h'}, {"version", 0, 0, 'V'}, @@ -1291,11 +1295,11 @@ int main(int argc, char *argv[]){ break; case 'e': if(optarg) - main_config.load_socket_id=atoi(optarg); + main_config.save_socket_id=atoi(optarg); break; case 't': if(optarg) - main_config.save_socket_id=atoi(optarg); + main_config.load_socket_id=atoi(optarg); break; case 1: main_config.lock_help=1; diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 4def2f6..3906420 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -2,7 +2,7 @@ // dictionary functions -/**yon_dictionary_create_empty(): +/**yon_dictionary_new(): * [EN] * Creates and returns empty dictionary * [RU] @@ -20,7 +20,7 @@ dictionary *yon_dictionary_new() return dict; } -/**yon_dictionary_copy_deep(dictionary *dict) +/**yon_dictionary_copy(dictionary *dict) * [EN] * * [RU] @@ -29,6 +29,7 @@ dictionary *yon_dictionary_new() dictionary *yon_dictinoary_copy(dictionary *dict){ dictionary *dct = yon_dictionary_new_with_data(dict->key,dict->data); dct->data_type= dict->data_type; + return dct; } /**yon_dictionary_copy_deep(dictionary *dict) @@ -47,22 +48,49 @@ dictionary *yon_dictionary_copy_deep(dictionary *dict){ return newone->first; } +/**int yon_dictionary_set_data(dictionary *dict, void *data) + * [EN] + * + * [RU] + * Установить элементу словаря [dict] значение [data] +*/ int yon_dictionary_set_data(dictionary *dict, void *data){ dict->data=data; } +/**int yon_dictionary_set_key(dictionary *dict, char *key) + * [EN] + * + * [RU] + * Изменяет ключ элемента словаря [dict] на [key] +*/ int yon_dictionary_set_key(dictionary *dict, char *key){ dict->key=key; + return 1; } +/** int yon_dictionary_set(dictionary *dict, char *key, void *data) + * [EN] + * + * [RU] +* Устанавливает значение ключа элемента словаря [dict] на [key] и его данные на [data] +*/ int yon_dictionary_set(dictionary *dict, char *key, void *data){ dict->key=key; dict->data=data; + return 1; } +/**int yon_dictionary_empty(dictionary *dict) + * [EN] + * + * [RU] + * Очищает элемент словаря [dict] от данных +*/ int yon_dictionary_empty(dictionary *dict){ dict->data=NULL; dict->data_type=DICTIONARY_OTHER_TYPE; + return 1; } /**yon_dictionary_switch_to_last(dictionary **dict) @@ -409,6 +437,13 @@ dictionary *yon_dictionary_get_nth(dictionary *dict, int place) // char functions +int yon_char_find_last(char *source, char find){ + int size = strlen(source); + int i=size; + for (;source[i]!=find&&i>0;i--); + return i; +} + /**[EN] * * creates new char string by combining two char strings. @@ -445,8 +480,12 @@ char *yon_char_new(char *chr) return NULL; } -// char *yon_char_unite(char *source, ...) - +/**yon_char_unite(char *source, ...) + * [En] + * + * [RU] + * Объединяет строку [source] со всеми строками, написанными в [...] +*/ char *yon_char_unite(char *source, ...){ va_list arglist; char *new_char=NULL; @@ -494,6 +533,12 @@ char *yon_char_divide(char *source, int dividepos) return cut; } +/**yon_char_find_count(char *source, char *find) + * [EN] + * + * [RU] + * Считает количество символов [find] в строке [source] +*/ int yon_char_find_count(char *source, char *find){ char *working_string=yon_char_new(source); int i=0; @@ -535,9 +580,8 @@ char *yon_char_divide_search(char *source, char *dividepos, int delete_divider) cut = yon_char_divide(source, leng); return cut; } - else - return source; } + return source; } /**yon_char_from_int(int int_to_convert) @@ -568,23 +612,28 @@ char *yon_char_from_int(int int_to_convert) * [RU] * Заменяет в строке [source] все вхождения строки [find] на [replace] */ -char *yon_char_replace(char *source, char *find, char*replace){ - char *final=NULL; - char *temp=NULL; - if(!strstr(replace,find)){ - while ((final=strstr(source,find))){ - temp=malloc(strlen(source)-strlen(final)); - memset(temp,0,strlen(source)-strlen(final)+strlen(replace)); - memcpy(temp,source,strlen(source)-strlen(final)); - temp=yon_char_append(temp,replace); - source=yon_char_append(temp,final+1); +char *yon_char_replace(char *source, char *find, char*replace){ + if (!strstr(replace,find)){ + + + char *final=NULL; + char *temp=NULL; + if(!strstr(replace,find)){ + while ((final=strstr(source,find))){ + temp=malloc(strlen(source)-strlen(final)); + memset(temp,0,strlen(source)-strlen(final)+strlen(replace)); + memcpy(temp,source,strlen(source)-strlen(final)); + temp=yon_char_append(temp,replace); + source=yon_char_append(temp,final+1); + } + } - return source; } + return source; } -/**[EN] - * char **yon_char_parse(char *parameters, int *size, char *divider) +/**yon_char_parse(char *parameters, int *size, char *divider) + * [EN] * Parses string [parameters], divided by [divider], * then returns parsed string array and sets [size] to * size of returned array @@ -701,15 +750,19 @@ config_str yon_char_parsed_new (int *size, ...){ return new_parsed; } +/**yon_char_parsed_copy(config_str *source, config_str *to_copy) + * [EN] + * + * [RU] + * Копирует массив строк [to_copy] в [source] +*/ void yon_char_parsed_copy(config_str *source, config_str *to_copy){ - if (source&&to_copy&&*to_copy){ + if (source&&!*source&&to_copy&&*to_copy){ int size=0; - config_str new_char = yon_char_parsed_new(&size,(*to_copy)[0],NULL); - for (int i=1;(*to_copy)[i];i++){ + config_str new_char = yon_char_parsed_new(&size,(*to_copy)[0]); + for (int i=0;(*to_copy)[i];i++){ new_char = yon_char_parsed_append(new_char,&size,yon_char_new((*to_copy)[i])); } - new_char = yon_char_parsed_append(new_char,&size,NULL); - if (new_char) *source = new_char; } } @@ -727,12 +780,24 @@ config_str yon_char_parsed_append(config_str parsed, int *size, char *string){ return new_parsed; } - +/**yon_ubl_check_root() + * [EN] + * + * [RU] + * Возвращает 1 если приложение было запущено от root +*/ int yon_ubl_check_root(){ if (getuid()==0) return 1; else return 0; } +/**yon_ubl_root_user_get() + * [EN] + * + * [RU] + * Возвращает имя пользователя. + * Если пользователь запустил приложение через root, выводится имя пользователя, запустившего приложение через root +*/ char *yon_ubl_root_user_get(){ char *user=NULL; if (yon_ubl_check_root()){ @@ -750,6 +815,14 @@ char *yon_ubl_root_user_get(){ return getlogin(); } +char *yon_ubl_user_get_home_directory(){ + FILE *path = popen(get_home_dir_command,"r"); + char *ret = g_malloc(4096); + fgets(ret,4096,path); + ret=yon_char_divide_search(ret,"\n",-1); + return ret; +} + // parsing functions @@ -1086,7 +1159,7 @@ config_str yon_config_load(char *command, int *str_len){ * Выполняет команду [command], добавляя в конец все записи конфига в таком виде: * [ПАРАМЕТР1]="[значения1]" [ПАРАМЕТР2]="[значения2]" */ -int yon_config_save(char *command){ +int yon_config_save_registered(char *command){ check_config{ dictionary *dict = NULL; for_dictionaries(dict,__yon__config__strings){ @@ -1120,18 +1193,6 @@ config_str yon_config_get_all(int *size){ } else return NULL; } -/**[EN] - * int yon_config_save(char *command) - * Saves config with [command] - * [RU] - * Выполняет команду [command] -*/ -// int yon_config_save(char *command) -// { -// FILE *output = popen(command, "r"); -// return 1; -// } - /**char *yon_config_get_parameter(config parameters, int size, char *param) * [EN] * Gets parameter [param] from parameter list [parameters] of size [size]; @@ -1236,7 +1297,7 @@ void yon_terminal_integrated_launch(GtkWidget *place_to_show, char* command, voi VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL); vte_terminal_set_pty(VTE_TERMINAL(terminal),pty); gtk_container_add(GTK_CONTAINER(place_to_show),terminal); - char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ;exit 0","\n",NULL); + char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",command," ; sleep 5;exit 0","\n",NULL); printf("%s\n",install_command); if(endwork_function) g_signal_connect(G_OBJECT(terminal), "child-exited", G_CALLBACK(endwork_function), endwork_function_argument); @@ -1322,15 +1383,36 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end gtk_widget_show_all(terminal); } #endif + // Window config functions + #define check_window_config_setup if(__yon_window_config_target_window) + + typedef struct { + char *parameter_name; + enum YON_TYPE containing_type; + GtkWidget *track_widget; + char *property_name; + } __yon_listener_parameter; + + typedef struct { + char *parameter_name; + char *section; + enum YON_TYPE containing_type; + void *property; + } __yon_custom_parameter; + struct { int x; int y; int width; int height; int fullscreen; + dictionary *custom_listeners; + dictionary *custom_parameters; + dictionary *deleted_parameters; } __yon_main_window_config; + static GtkWindow *__yon_window_config_target_window = NULL; static GKeyFile *__yon_window_config_file = NULL; static char *__yon_window_config_path = NULL; @@ -1341,15 +1423,62 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width); g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height); g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen); + dictionary *dict=NULL; + if (__yon_main_window_config.custom_listeners) + for_dictionaries(dict,__yon_main_window_config.custom_listeners){ + __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val); + switch(param->containing_type){ + case YON_TYPE_STRING: + g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val)); + break; + case YON_TYPE_INT: + g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val)); + break; + case YON_TYPE_BOOLEAN: + g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val)); + break; + case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break; + } + } + if (__yon_main_window_config.custom_parameters) + for_dictionaries(dict,__yon_main_window_config.custom_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + switch (param->containing_type){ + case YON_TYPE_STRING: + g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property); + break; + case YON_TYPE_INT: + g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property); + break; + case YON_TYPE_BOOLEAN: + g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property); + break; + default: + break; + } + } + if (__yon_main_window_config.deleted_parameters) + for_dictionaries(dict,__yon_main_window_config.deleted_parameters){ + __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); + g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL); + } g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL); } void yon_get_is_fullscreen(){ gtk_window_is_maximized(__yon_window_config_target_window); __yon_main_window_config.fullscreen = gtk_window_is_maximized(__yon_window_config_target_window); + if (!__yon_main_window_config.fullscreen) gtk_window_get_position(__yon_window_config_target_window,&__yon_main_window_config.x,&__yon_main_window_config.y); } - + /**yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event) + * [EN] + * + * [RU] + * Сохраняет настройки основного окна. Вызывается когда основное окно уничтожается. + */ void yon_on_configured_window_destroy(GtkWidget* self,GdkEvent* event){ check_window_config_setup{ yon_get_is_fullscreen(); @@ -1367,6 +1496,12 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end } } + /**yon_window_config_setup(GtkWindow *window) + * [EN] + * + * [RU] + * Устанавливает указатель на окно для отслеживания его положения и размера + */ void yon_window_config_setup(GtkWindow *window){ __yon_window_config_target_window = window; g_signal_connect(G_OBJECT(window),"delete-event",G_CALLBACK(yon_on_configured_window_destroy),NULL); @@ -1378,6 +1513,12 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end if(__yon_main_window_config.fullscreen ==1) gtk_window_maximize(__yon_window_config_target_window); } + /**yon_window_config_load(char *path) + * [EN] + * + * [RU] + * Загружает конфиг окна и инициализирует отслеживание его параметров + */ int yon_window_config_load(char *path){ __yon_window_config_file = g_key_file_new(); __yon_window_config_path=yon_char_new(path); @@ -1399,6 +1540,27 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end __yon_main_window_config.width = g_key_file_get_integer(__yon_window_config_file,"window","WindowWidth",NULL); __yon_main_window_config.height = g_key_file_get_integer(__yon_window_config_file,"window","WindowHeight",NULL); __yon_main_window_config.fullscreen = g_key_file_get_integer(__yon_window_config_file,"window","fullscreen",NULL); + dictionary *dict=NULL; + if (__yon_main_window_config.custom_listeners) + for_dictionaries(dict,__yon_main_window_config.custom_listeners){ + __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*); + GValue *val = g_malloc0(sizeof(GValue)); + g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val); + switch(param->containing_type){ + case YON_TYPE_STRING: + g_value_set_string(val,g_key_file_get_string(__yon_window_config_file,"window",param->parameter_name, NULL)); + break; + case YON_TYPE_INT: + g_value_set_int(val,g_key_file_get_integer(__yon_window_config_file,"window",param->parameter_name, NULL)); + break; + case YON_TYPE_BOOLEAN: + gboolean res = g_key_file_get_boolean(__yon_window_config_file,"window",param->parameter_name, NULL); + g_value_set_boolean(val,res); + break; + default:printf("\033[0;31mCannot load %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break; + } + g_object_set_property(G_OBJECT(param->track_widget),param->property_name,val); + } if (__yon_main_window_config.width==0) __yon_main_window_config.width=800; if (__yon_main_window_config.height==0) __yon_main_window_config.height=600; gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height); @@ -1413,6 +1575,46 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end gtk_window_move(__yon_window_config_target_window,__yon_main_window_config.x,__yon_main_window_config.y); gtk_window_resize(__yon_window_config_target_window,__yon_main_window_config.width,__yon_main_window_config.height); } + + config_str yon_window_config_get_section(char *section, gsize *size){ + config_str key = g_key_file_get_keys(__yon_window_config_file,section,size,NULL); + return key; + } + + /**yon_window_config_add_custom_parameter(GtkWidget *widget, char *param_name, char *widget_property) + * [EN] + * + * [RU] + * Добавляет параметр виджета [widget] по названию [widget_property] для отслеживания и сохраняет его в конфиг под ключом [param_name]. + */ + void yon_window_config_add_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type){ + __yon_listener_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_listener_parameter)); + param->parameter_name = yon_char_new(param_name); + param->track_widget = widget; + param->property_name = yon_char_new(widget_property); + param->containing_type = val_type; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_listeners,param->parameter_name,param); + } + + void yon_window_config_add_custom_parameter(char *param_name, char *section, void *tracked_value, enum YON_TYPE val_type){ + __yon_custom_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_custom_parameter)); + param->parameter_name = yon_char_new(param_name); + param->section=section; + param->property = tracked_value; + param->containing_type = val_type; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.custom_parameters,param->parameter_name,param); + } + + void yon_window_config_erase_custom_parameter(char *param_name, char *section){ + __yon_custom_parameter *param = NULL; + param = yon_remalloc(param,sizeof(__yon_custom_parameter)); + param->parameter_name=param_name; + param->section=section; + yon_dictionary_add_or_create_if_exists_with_data(__yon_main_window_config.deleted_parameters,param->parameter_name,param); + } + GtkWidget *yon_ubl_menu_item_about_new(char *buttonname){ GtkWidget *menu_item = gtk_menu_item_new(); gtk_style_context_add_class(gtk_widget_get_style_context(menu_item),"menuitembottom"); @@ -1440,6 +1642,16 @@ GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname){ gtk_widget_show_all(menu_item); return menu_item; } + + +// other Gtk functions + +/**yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size) + * [EN] + * + * [RU] + * Добавляет в Комбобокс [combo] все строки из массива строк [parameters] размера [size] +*/ int yon_gtk_combo_box_text_fill(GtkWidget *combo, config_str parameters,int size){ if (combo&¶meters){ for (int i=0;i #include #include +#include +#include #include #include #include -#include "ubl-cmake.h" +#include "../compile/ubl-cmake.h" #ifdef WEBKIT_FOUND #include #endif #define DesktopPath "/usr/share/applications/" #define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) + #define try bool __HadError=false; #define catch(x) ExitJmp:if(__HadError) #define throw(x) {__HadError=true;goto ExitJmp;} #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) typedef enum { @@ -123,6 +127,8 @@ void *yon_dictionary_free_all(dictionary *dictionary,void (data_manipulation)(vo // 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); @@ -159,6 +165,8 @@ int yon_ubl_check_root(); char *yon_ubl_root_user_get(); +char *yon_ubl_user_get_home_directory(); + // parsing functions config_str philos_list_user(int* size); @@ -171,7 +179,7 @@ apps *yon_apps_get_by_name(apps *applist, char *name, int size); config_str yon_config_load(char *command, int *str_len); -int yon_config_save(char *command); +int yon_config_save_registered(char *command); char *yon_config_get_parameter(config_str parameters, int size, char *param); @@ -211,6 +219,16 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end #endif +enum YON_TYPE{ + YON_TYPE_STRING, + YON_TYPE_INT, + 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]. @@ -231,9 +249,13 @@ void yon_window_config_setup(GtkWindow *window); int yon_window_config_load(char *path); -GtkWidget *yon_ubl_menu_item_about_new(char *buttonname); +config_str yon_window_config_get_section(char *section, gsize *size); -GtkWidget *yon_ubl_menu_item_documentation_new(char *buttonname); +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_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); @@ -342,4 +364,4 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name); void yon_ubl_browser_window_open(char *link, char *browser_window_name); #endif #endif -#endif \ No newline at end of file +#endif diff --git a/source/view_add.c b/source/view_add.c index f9e7628..1e27bd5 100644 --- a/source/view_add.c +++ b/source/view_add.c @@ -178,6 +178,12 @@ char* add_get_select_device_to_level_2() { } } +int add_get_index_type_quota() { + return gtk_combo_box_get_active(GTK_COMBO_BOX(add_widgets->cbxTempQuotaObj)); +} +int add_get_index_volume_quota() { + return gtk_combo_box_get_active(GTK_COMBO_BOX(add_widgets->cbxTempQuotaLevel2)); +} int add_get_soft_size() { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(add_widgets->chkSoftRestrictionTemp))) { diff --git a/source/view_add.h b/source/view_add.h index 790d323..03e53a4 100644 --- a/source/view_add.h +++ b/source/view_add.h @@ -55,6 +55,8 @@ temp_config* get_add_config(); void add_set_active_widgets_device_io(GtkWidget *check, GtkWidget *spin, GtkWidget *combo); void add_get_cmd_group(char* cmd_get_group); char* add_get_select_device_to_level_2(); +int add_get_index_volume_quota(); +int add_get_index_type_quota(); void add_get_systemd_cgls(char* cmd_systemd_cgls); void add_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, size_t value); #endif \ No newline at end of file diff --git a/source/view_edit.c b/source/view_edit.c index 6e7659c..9b84203 100644 --- a/source/view_edit.c +++ b/source/view_edit.c @@ -39,6 +39,7 @@ temp_set_window *edit_setup_window(char* glade_path){ edit_widgets->chbTempWrite = yon_gtk_builder_get_widget(builder,"chbEditWrite"); edit_widgets->cbtTempWrite = yon_gtk_builder_get_widget(builder,"cbtEditWrite"); edit_widgets->entryTempCmd = yon_gtk_builder_get_widget(builder,"entryEditCmd"); + edit_widgets->lblInfoObjQuotas = yon_gtk_builder_get_widget(builder,"lblInfoObjQuotas"); device_fill_disk(edit_widgets->cbtTempDevice); edit_localization(edit_widgets); philos_temp_config_init(&obj_edit_config); @@ -307,3 +308,7 @@ void edit_temp_set(int value, int pow_mem, GtkWidget* cheek, GtkWidget* spin, Gt } } +void edit_temp_set_obj_quota(char* type, char* value) { + gtk_label_set_label(GTK_LABEL(edit_widgets->lblInfoObjQuotas), yon_char_unite(type, " " ,value, NULL)); +} + diff --git a/source/view_edit.h b/source/view_edit.h index e8bf8da..a0e3270 100644 --- a/source/view_edit.h +++ b/source/view_edit.h @@ -59,6 +59,7 @@ int edit_get_limit_swap_size(); void edit_config_init(); void set_gui_device(); temp_config* get_edit_config(); +void edit_temp_set_obj_quota(char* type, char* value); void edit_set_active_widgets_device_io(GtkWidget *check, GtkWidget *spin, GtkWidget *combo); void edit_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, size_t value); #endif \ No newline at end of file diff --git a/terminal-commands/Makefile b/terminal-commands/Makefile new file mode 100644 index 0000000..a208c59 --- /dev/null +++ b/terminal-commands/Makefile @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +#SHELL := /bin/bash + +default_target: all + +.PHONY: all init + +all: init + +init: + @install -Dm644 -t "/usr/share/polkit-1/actions/" "com.ublinux.gdb-debug.policy" \ No newline at end of file diff --git a/terminal-commands/com.ublinux.gdb-debug.policy b/terminal-commands/com.ublinux.gdb-debug.policy new file mode 100644 index 0000000..f6d52d5 --- /dev/null +++ b/terminal-commands/com.ublinux.gdb-debug.policy @@ -0,0 +1,24 @@ + + + + + UBLinux + https://ublinux.ru + + + Run gdb as root + Запуск утилиты gdb с правами root + Authentication is required to run gdb + Требуется авторизация для запуска утилиты gdb с правами root + + auth_admin + auth_admin + auth_admin + + /usr/bin/gdb + true + + + diff --git a/terminal-commands/make-pot.txt b/terminal-commands/make-pot.txt new file mode 100644 index 0000000..d2d2f2f --- /dev/null +++ b/terminal-commands/make-pot.txt @@ -0,0 +1 @@ +xgettext -k_ -o ubl-settings-TEMPLATE.pot --language=C source/ubl-settings-TEMPLATE.c source/ubl-settings-TEMPLATE.h source/ubl-strings.h \ No newline at end of file diff --git a/terminal-commands/sudo-debug.sh b/terminal-commands/sudo-debug.sh new file mode 100755 index 0000000..d13d15b --- /dev/null +++ b/terminal-commands/sudo-debug.sh @@ -0,0 +1 @@ +pkexec /usr/bin/gdb "$@" \ No newline at end of file diff --git a/terminal-commands/update-po.txt b/terminal-commands/update-po.txt new file mode 100644 index 0000000..4769627 --- /dev/null +++ b/terminal-commands/update-po.txt @@ -0,0 +1 @@ +msgmerge --update ubl-settings-TEMPLATE_ru.po ubl-settings-TEMPLATE.pot \ No newline at end of file diff --git a/ubl-settings-resourcequota.glade b/ubl-settings-resourcequota.glade index 06150b9..57eb21d 100644 --- a/ubl-settings-resourcequota.glade +++ b/ubl-settings-resourcequota.glade @@ -1325,7 +1325,7 @@ 5 5 5 - Quota object + Quota object: False @@ -1334,7 +1334,7 @@ - + True False 5 diff --git a/ubl-settings-resourcequota.pot b/ubl-settings-resourcequota.pot index f9e2676..69e01e4 100644 --- a/ubl-settings-resourcequota.pot +++ b/ubl-settings-resourcequota.pot @@ -218,6 +218,9 @@ msgstr "" msgid "Quota object" msgstr "" +msgid "Quota object:" +msgstr "" + msgid "RAM limit" msgstr "" diff --git a/ubl-settings-resourcequota_ru.po b/ubl-settings-resourcequota_ru.po index 731493d..90cee88 100644 --- a/ubl-settings-resourcequota_ru.po +++ b/ubl-settings-resourcequota_ru.po @@ -321,6 +321,9 @@ msgstr "Квоты настроек - Редактирование" msgid "Quota object" msgstr "Объект квоты" +msgid "Quota object:" +msgstr "Объект квоты:" + msgid "Quota\nobject" msgstr "Объект\nквоты"