From 4532e6841125bca669fd8d0422724cd941d0c60f Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Thu, 3 Aug 2023 18:00:06 +0600 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B0=D1=81=D1=82=D0=B8=D1=87=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D1=83=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/model/load.c | 22 ++++- source/model/save.c | 45 ++++++--- source/model/ubl-utils.c | 207 ++++++++++++++++++++++++++++++++++----- source/model/ubl-utils.h | 26 ++++- source/ubl-strings.h | 4 +- 5 files changed, 262 insertions(+), 42 deletions(-) diff --git a/source/model/load.c b/source/model/load.c index 2db5d56..de1e9e6 100644 --- a/source/model/load.c +++ b/source/model/load.c @@ -31,7 +31,7 @@ void load_template_load_cfg(config_all* _all_config, char* cmd) { flag_find = 1; } } - if ((strstr(str_value, "enable") || strstr(str_value, "disable")) && flag_find == 0) { + if (((strstr(str_value, "enable") || strstr(str_value, "disable")) || yon_char_find_count(str_key, ":") == 1) && flag_find == 0) { disk_status* disk_cfg = malloc(sizeof(disk_status)); disk_cfg->deferring_size = 0; disk_cfg->deferring_file = 0; @@ -46,6 +46,17 @@ void load_template_load_cfg(config_all* _all_config, char* cmd) { config_disk_status->fs = yon_char_new(_config_disk->file_system); config_disk_status->mount_point = yon_char_new(_config_disk->mounted); config_disk_status->name = yon_char_new(_config_disk->type_dick); + if (yon_char_find_count(str_key, ":") == 1 && (!strstr(str_value, "enable") && !strstr(str_value, "disable"))) { + int size_value = 0; + char** arr_values = philos_str_split(str_value, &size_value, ":"); + config_disk_status->deferring_size = atoll(arr_values[4]); + config_disk_status->deferring_file = atoll(arr_values[5]); + config_disk_status->status = 2; + philos_free_string_array(&arr_values, size_value); + } + else { + + } } } @@ -55,6 +66,9 @@ void load_template_load_cfg(config_all* _all_config, char* cmd) { } else { + if (yon_char_find_count(str_key, ":") == 1) { + return; + } config_u_g_p* _config = malloc(sizeof(config_u_g_p)); model_null_str_writing(_config); _config->loaded_keys = yon_char_new(str_key); @@ -88,6 +102,9 @@ void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) { if (strstr(str_key, "prjquota")) { return; } + if (yon_char_find_count(str_key, ":") == 1) { + return; + } if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) { int size_point = 0; char** arr_keys = philos_str_split(yon_char_new(str_key), &size_point, ":"); @@ -122,6 +139,9 @@ void load_pars_keys_u_g(config_u_g_p* _config, char* str_key, int index) { } void load_pars_keys_p(config_u_g_p* _config, char* str_key, int index) { + if (yon_char_find_count(str_key, ":") == 1) { + return; + } if (strstr(str_key, "prjquota")) { if (yon_char_find_count(str_key, ":") || yon_char_find_count(str_key, ",")) { int size_point = 0; diff --git a/source/model/save.c b/source/model/save.c index 9fa6704..fe45a54 100644 --- a/source/model/save.c +++ b/source/model/save.c @@ -66,30 +66,45 @@ char* set_status_and_del(config_all* _all_config) { char* cmd = yon_char_new(""); for (int j=0; j < _all_config->v_disk_status.vectorList.total;j++) { disk_status* config_disk_status = (disk_status*)_all_config->v_disk_status.pfVectorGet(&_all_config->v_disk_status, j); - if (config_disk_status->status == 2) { - cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota:" , config_disk_status->device, "]=enable ", NULL); - cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota:" , config_disk_status->device, "]=enable ", NULL); - cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota:" , config_disk_status->device, "]=enable ", NULL); + if (config_disk_status->status == 2 && (config_disk_status->deferring_size == 0 && config_disk_status->deferring_file == 0)) { + cmd = yon_char_unite(cmd, "DISK_QUOTA[usrquota:" , config_disk_status->device, "]=enable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[grpquota:" , config_disk_status->device, "]=enable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[prjquota:" , config_disk_status->device, "]=enable ", NULL); + yon_window_config_add_custom_parameter(config_disk_status->device, "deferring_size", NULL, YON_TYPE_INT); + yon_window_config_add_custom_parameter(config_disk_status->device, "deferring_file", NULL, YON_TYPE_INT); + yon_window_config_add_custom_parameter(config_disk_status->device, config_disk_status->device, NULL, YON_TYPE_STRING); } else if (config_disk_status->status == 1) { - cmd = yon_char_unite(cmd, " DISK_QUOTA[usrquota:" , config_disk_status->device, "]=disable ", NULL); - cmd = yon_char_unite(cmd, " DISK_QUOTA[grpquota:" , config_disk_status->device, "]=disable ", NULL); - cmd = yon_char_unite(cmd, " DISK_QUOTA[prjquota:" , config_disk_status->device, "]=disable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[usrquota:" , config_disk_status->device, "]=disable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[grpquota:" , config_disk_status->device, "]=disable ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[prjquota:" , config_disk_status->device, "]=disable ", NULL); + yon_window_config_add_custom_parameter(config_disk_status->device, "deferring_size", NULL, YON_TYPE_INT); + yon_window_config_add_custom_parameter(config_disk_status->device, "deferring_file", NULL, YON_TYPE_INT); + yon_window_config_add_custom_parameter(config_disk_status->device, config_disk_status->device, NULL, YON_TYPE_STRING); + } + if (config_disk_status->status == 2 && (config_disk_status->deferring_size != 0 || config_disk_status->deferring_file != 0)) { + cmd = yon_char_unite(cmd, "DISK_QUOTA[usrquota:" , config_disk_status->device, "]=0:0:0:0:",yon_char_from_int(config_disk_status->deferring_size), ":", yon_char_from_int(config_disk_status->deferring_file)," ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[grpquota:" , config_disk_status->device, "]=0:0:0:0:",yon_char_from_int(config_disk_status->deferring_size), ":", yon_char_from_int(config_disk_status->deferring_file)," ", NULL); + cmd = yon_char_unite(cmd, "DISK_QUOTA[prjquota:" , config_disk_status->device, "]=0:0:0:0:",yon_char_from_int(config_disk_status->deferring_size), ":", yon_char_from_int(config_disk_status->deferring_file)," ", NULL); + yon_window_config_add_custom_parameter(config_disk_status->device, "deferring_size", &config_disk_status->deferring_size, YON_TYPE_INT); + yon_window_config_add_custom_parameter(config_disk_status->device, "deferring_file", &config_disk_status->deferring_file, YON_TYPE_INT); + yon_window_config_add_custom_parameter(config_disk_status->device, config_disk_status->device, config_disk_status->device, YON_TYPE_STRING); } } + puts(cmd); return cmd; } char* wrapper_save_format_status_cmd_all(config_all* _all_config) { - char* cmd = save_format_status_cmd_all(&_all_config->v_user, &_all_config->v_disk_status); - cmd = yon_char_unite(cmd, " ", save_format_status_cmd_all(&_all_config->v_group ,&_all_config->v_disk_status), NULL); - cmd = yon_char_unite(cmd, " ", save_format_status_cmd_all(&_all_config->v_project, &_all_config->v_disk_status), NULL); - if (strlen(cmd) > 5) { - return cmd; - } - else { + //char* cmd = save_format_status_cmd_all(&_all_config->v_user, &_all_config->v_disk_status); + //cmd = yon_char_unite(cmd, " ", save_format_status_cmd_all(&_all_config->v_group ,&_all_config->v_disk_status), NULL); + //cmd = yon_char_unite(cmd, " ", save_format_status_cmd_all(&_all_config->v_project, &_all_config->v_disk_status), NULL); + //if (strlen(cmd) > 5) { + // return cmd; + //} + //else { return set_status_and_del(_all_config); - } + //} } diff --git a/source/model/ubl-utils.c b/source/model/ubl-utils.c index b184b58..57196f0 100644 --- a/source/model/ubl-utils.c +++ b/source/model/ubl-utils.c @@ -2,7 +2,7 @@ // dictionary functions -/**yon_dictionary_create_empty(): +/**yon_dictionary_new(): * [EN] * Creates and returns empty dictionary * [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) @@ -65,6 +66,7 @@ int yon_dictionary_set_data(dictionary *dict, void *data){ */ int yon_dictionary_set_key(dictionary *dict, char *key){ dict->key=key; + return 1; } /** int yon_dictionary_set(dictionary *dict, char *key, void *data) @@ -76,6 +78,7 @@ int yon_dictionary_set_key(dictionary *dict, char *key){ int yon_dictionary_set(dictionary *dict, char *key, void *data){ dict->key=key; dict->data=data; + return 1; } /**int yon_dictionary_empty(dictionary *dict) @@ -87,6 +90,7 @@ int yon_dictionary_set(dictionary *dict, char *key, void *data){ int yon_dictionary_empty(dictionary *dict){ dict->data=NULL; dict->data_type=DICTIONARY_OTHER_TYPE; + return 1; } /**yon_dictionary_switch_to_last(dictionary **dict) @@ -433,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. @@ -568,9 +579,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) @@ -595,26 +605,30 @@ char *yon_char_from_int(int int_to_convert) return ch; } - /**yon_char_replace(char *source, char *find, char*replace) * [EN] * * [RU] * Заменяет в строке [source] все вхождения строки [find] на [replace] */ -char *yon_char_replace(char *source, char *find, char*replace){ - char *final=NULL; - char *temp=NULL; - if(!strstr(replace,find)){ - while ((final=strstr(source,find))){ - temp=malloc(strlen(source)-strlen(final)); - memset(temp,0,strlen(source)-strlen(final)+strlen(replace)); - memcpy(temp,source,strlen(source)-strlen(final)); - temp=yon_char_append(temp,replace); - source=yon_char_append(temp,final+1); +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; } /**yon_char_parse(char *parameters, int *size, char *divider) @@ -625,18 +639,15 @@ char *yon_char_replace(char *source, char *find, char*replace){ */ char **yon_char_parse(char *parameters, int *size, char *divider){ char **string=NULL; - if (!strstr(parameters, divider)) { - return NULL; - } int i=1; string=malloc(sizeof(char*)); char *paramline=yon_char_new(parameters); char *param; while ((param=yon_char_divide_search(paramline,divider,1))){ - if (strcmp(param,paramline)==0) break; string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(param); i++; + if (strcmp(param,paramline)==0) break; } string=realloc(string,sizeof(char*)*i); string[i-1]=yon_char_new(paramline); @@ -803,6 +814,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 @@ -1368,30 +1387,89 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end #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; - + void yon_window_config_save(){ g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x); g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y); g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width); g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height); g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen); + 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) @@ -1461,6 +1539,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); @@ -1476,6 +1575,70 @@ void yon_terminal_integrated_start(GtkWidget *terminal, char* command, void *end 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_listener(GtkWidget *widget, char *param_name, char *widget_property, enum YON_TYPE val_type) + * [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); + } + + int yon_window_config_get_parameter(char *section, char *config_parameter, void *return_value, enum YON_TYPE type){ + GError *err=NULL; + switch (type){ + case YON_TYPE_BOOLEAN: + *((int*)return_value) = g_key_file_get_boolean(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_INT: + *((int*)return_value) = g_key_file_get_integer(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_STRING: + *((char**)return_value) = g_key_file_get_string(__yon_window_config_file,section,config_parameter,&err); + if (err) return 0; else return 1; + break; + case YON_TYPE_STRING_LIST: + gsize size=0; + *((char***)return_value) = g_key_file_get_string_list(__yon_window_config_file,section,config_parameter,&size,&err); + *((char***)return_value)=yon_remalloc(return_value,size+1); + *((char***)return_value)[size]=NULL; + if (err) return 0; else return 1; + break; + } + } + 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"); @@ -1754,8 +1917,8 @@ void yon_ubl_browser_window_open(char *link, char *browser_window_name){ if (!user) user=getlogin(); char *command=yon_char_unite("sudo -u ",user," xdg-open ", link,NULL); - yon_launch(command); + yon_launch_app(command); } #endif -#endif \ No newline at end of file +#endif diff --git a/source/model/ubl-utils.h b/source/model/ubl-utils.h index 01a5b70..a98d14e 100644 --- a/source/model/ubl-utils.h +++ b/source/model/ubl-utils.h @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -23,10 +25,11 @@ #define DesktopPath "/usr/share/applications/" #define for_dictionaries(obj, obj1) for (obj = obj1->first; obj != NULL; obj = obj->next) -#define for_iter(TreeIter,TreeModel) int _yon_valid =2; for(gtk_tree_model_get_iter_first(TreeModel,TreeIter); _yon_valid ==1;_yon_valid=gtk_tree_model_iter_next(TreeModel,TreeIter)) + #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 { @@ -124,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); @@ -160,6 +165,8 @@ int yon_ubl_check_root(); char *yon_ubl_root_user_get(); +char *yon_ubl_user_get_home_directory(); + // parsing functions apps *yon_apps_scan_and_parse_desktops(int *sizef); @@ -210,6 +217,13 @@ 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); @@ -233,6 +247,14 @@ 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_gtk_combo_box_fill(GtkWidget *combo, char **parameters,int size); int yon_gtk_combo_box_text_find(GtkWidget *combo_box, char *text_to_find); @@ -340,4 +362,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/ubl-strings.h b/source/ubl-strings.h index ce8e729..a300675 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -54,8 +54,8 @@ #define CMD_LOAD_GLOBAL "ubconfig --default --source global get security DISK_QUOTA[*]" #define CMD_LOAD_SYSTEM "ubconfig --default --source system get security DISK_QUOTA[*]" -#define CMD_SAVE_GLOBAL "ubconfig --default --target global set security" -#define CMD_SAVE_SYSTEM "ubconfig --default --target system set security" +#define CMD_SAVE_GLOBAL "ubconfig --target global set security" +#define CMD_SAVE_SYSTEM "ubconfig --target system set security" #define CMD_ALL_SAVE "ubconfig set security " #define CMD_ALL_REMOVE "ubconfig remove security " #define CMD_REMOVE_GLOBAL "ubconfig --target global --noexecute remove security "