|
|
|
@ -277,6 +277,7 @@ void clear_array() {
|
|
|
|
|
philos_free_string_array(&main_config.i_o_limit_read , main_config.size_tree_view);
|
|
|
|
|
philos_free_string_array(&main_config.i_o_limit_write , main_config.size_tree_view);
|
|
|
|
|
philos_free_string_array(&main_config.disk, main_config.size_tree_view);
|
|
|
|
|
|
|
|
|
|
philos_free_string_array(&main_config.array_del_line, main_config.size_array_del_line);
|
|
|
|
|
main_config.size_array_del_line = 0;
|
|
|
|
|
|
|
|
|
@ -425,6 +426,7 @@ void str_split_value(char* values, int index) {
|
|
|
|
|
|
|
|
|
|
void set_pow_size(char* str_find, int** array_size, char*** array_data , int index) {
|
|
|
|
|
char* disk = NULL;
|
|
|
|
|
|
|
|
|
|
if (strstr(str_find,"\"") != NULL) {
|
|
|
|
|
yon_char_divide(str_find, 0);
|
|
|
|
|
size_t length = strlen(str_find);
|
|
|
|
@ -456,8 +458,11 @@ void set_pow_size(char* str_find, int** array_size, char*** array_data , int ind
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
|
else if (strstr(str_find,"T") != NULL) {
|
|
|
|
|
puts(str_find);
|
|
|
|
|
*array_size = philos_int_append(*array_size, &index, 3);
|
|
|
|
|
printf("%d\n\n", (*array_size)[index-1]);
|
|
|
|
|
str_find = yon_char_divide(str_find, length-1);
|
|
|
|
|
|
|
|
|
|
str_find = yon_char_unite(str_find," ", STR_TB, NULL);
|
|
|
|
|
index--;
|
|
|
|
|
}
|
|
|
|
@ -710,6 +715,7 @@ void wrapper_edit_show() {
|
|
|
|
|
edit_set_write_device(main_config.i_o_limit_write[index], main_config.i_o_limit_write_size[index]);
|
|
|
|
|
edit_set_read_device(main_config.i_o_limit_read[index], main_config.i_o_limit_read_size[index]);
|
|
|
|
|
edit_event(get_widget_edit());
|
|
|
|
|
edit_init_windows();
|
|
|
|
|
edit_set_limit_swap(main_config.swap[index], main_config.swap_size[index]);
|
|
|
|
|
// edit_set_select_device(main_config.cpu_limit[index]);
|
|
|
|
|
g_signal_connect(G_OBJECT(get_widget_edit()->btnSaveEditSave), "clicked", G_CALLBACK(main_edit_btn_save), NULL);
|
|
|
|
@ -737,7 +743,7 @@ void tree_view_del_line() {
|
|
|
|
|
g_object_ref(main_config.list);
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->treeViewMain), NULL);
|
|
|
|
|
gtk_list_store_clear(main_config.list);
|
|
|
|
|
char* key_del = save_format_key(main_config.size_tree_view-1);
|
|
|
|
|
char* key_del = save_format_key(index);
|
|
|
|
|
if (key_del != NULL) {
|
|
|
|
|
main_config.array_del_line = yon_char_parsed_append(main_config.array_del_line, &main_config.size_array_del_line, yon_char_new(key_del));
|
|
|
|
|
free(key_del);
|
|
|
|
@ -776,6 +782,7 @@ void tree_view_del_line() {
|
|
|
|
|
main_config.i_o_limit_write_size = remove_element_int_array(main_config.i_o_limit_write_size, &main_config.size_tree_view,index);
|
|
|
|
|
main_fill_tree_view_after_remove();
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->treeViewMain), model);
|
|
|
|
|
free(str_iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void wrapper_all_save() {
|
|
|
|
@ -873,7 +880,7 @@ int check_save(dictionary* load_cfg) {
|
|
|
|
|
size_t size_cfg_gui = yon_dict_len(main_config.save_cfg_gui);
|
|
|
|
|
size_t size_cfg_load = yon_dict_len(load_cfg);
|
|
|
|
|
if (size_cfg_gui!=size_cfg_load) {
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
for_dictionaries(ptr_dict_gui, main_config.save_cfg_gui) {
|
|
|
|
|
for_dictionaries(ptr_dict_load, load_cfg) {
|
|
|
|
@ -893,13 +900,13 @@ int check_save(dictionary* load_cfg) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_check_key == 0 || flag_check_value == 0) {
|
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
int template_format_str_save(dictionary* load_cfg, char* source_set_cmd, char* source_remove_cmd) {
|
|
|
|
|
char* cmd_remove = template_format_str_remove_save(source_remove_cmd);
|
|
|
|
|
char* cmd_remove = template_format_str_remove_save(load_cfg, source_remove_cmd);
|
|
|
|
|
char* cmd_set = template_format_str_set_save(load_cfg, source_set_cmd);
|
|
|
|
|
if (cmd_set != NULL && cmd_remove != NULL) {
|
|
|
|
|
yon_config_save(yon_char_unite(cmd_set, "; " , cmd_remove, NULL));
|
|
|
|
@ -926,30 +933,26 @@ char* template_format_str_set_save(dictionary* load_cfg, char* source_set_cmd) {
|
|
|
|
|
yon_dictionary_free_all(main_config.save_cfg_gui, NULL);
|
|
|
|
|
char* cmd = yon_char_new(source_set_cmd);
|
|
|
|
|
main_config.save_cfg_gui = yon_dictionary_create_empty();
|
|
|
|
|
if (check_save(load_cfg)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
int flag_save = 0;
|
|
|
|
|
for (size_t index = 0; index < main_config.size_tree_view; index++) {
|
|
|
|
|
char* key = NULL;
|
|
|
|
|
char* value = NULL;
|
|
|
|
|
key = save_format_key(index);
|
|
|
|
|
value = save_format_value(index);
|
|
|
|
|
key = yon_char_new(save_format_key(index));
|
|
|
|
|
value = yon_char_new(save_format_value(index));
|
|
|
|
|
main_config.save_cfg_gui = yon_dictionary_create_with_data_connected(main_config.save_cfg_gui, key, yon_char_new(value));
|
|
|
|
|
if (key != NULL && value != NULL) {
|
|
|
|
|
if (check_save(load_cfg) == 1) {
|
|
|
|
|
cmd = yon_char_unite(cmd, " " , key, "=" , value, " ", NULL);
|
|
|
|
|
flag_save = 1;
|
|
|
|
|
}
|
|
|
|
|
cmd = yon_char_unite(cmd, " " , key, "=" , value, NULL);
|
|
|
|
|
flag_save = 1;
|
|
|
|
|
}
|
|
|
|
|
if (key != NULL) {
|
|
|
|
|
free(key);
|
|
|
|
|
}
|
|
|
|
|
if (value != NULL) {
|
|
|
|
|
else if (value != NULL) {
|
|
|
|
|
free(value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_save) {
|
|
|
|
|
|
|
|
|
|
if (flag_save && check_save(load_cfg)== 0) {
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
free(cmd);
|
|
|
|
@ -957,7 +960,7 @@ char* template_format_str_set_save(dictionary* load_cfg, char* source_set_cmd) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* template_format_str_remove_save(char* source_remove_cmd) {
|
|
|
|
|
char* template_format_str_remove_save(dictionary* load_cfg, char* source_remove_cmd) {
|
|
|
|
|
char* cmd = yon_char_new(source_remove_cmd);
|
|
|
|
|
int flag_save = 0;
|
|
|
|
|
if (main_config.size_array_del_line == 0) {
|
|
|
|
@ -966,13 +969,13 @@ char* template_format_str_remove_save(char* source_remove_cmd) {
|
|
|
|
|
for (size_t index = 0; index < main_config.size_array_del_line; index++) {
|
|
|
|
|
char* key = main_config.array_del_line[index];
|
|
|
|
|
if (key != NULL) {
|
|
|
|
|
puts(key);
|
|
|
|
|
cmd = yon_char_unite(cmd, " " , key, " ", NULL);
|
|
|
|
|
flag_save = 1;
|
|
|
|
|
free(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag_save) {
|
|
|
|
|
philos_free_string_array(&main_config.array_del_line, main_config.size_array_del_line);
|
|
|
|
|
main_config.size_array_del_line = 0;
|
|
|
|
|
return cmd;
|
|
|
|
|
}
|
|
|
|
|
free(cmd);
|
|
|
|
|