Merge pull request 'Fixed compare config loading' (#55) from YanTheKaller/libublsettingsui-gtk3:master into master

Reviewed-on: #55
master v1.50
Dmitry Razumov 3 months ago
commit 6a50565a09

@ -1,6 +1,52 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 22.18C11.8667 22.181 11.7355 22.1465 11.62 22.08L3.87 17.61C3.76312 17.5464 3.67349 17.4575 3.60898 17.3511C3.54446 17.2448 3.50705 17.1242 3.5 17V8.00001C3.49838 7.86857 3.53181 7.73906 3.59684 7.62482C3.66187 7.51058 3.75616 7.41572 3.87 7.35001L11.62 2.87001C11.7346 2.80608 11.8637 2.77252 11.995 2.77252C12.1263 2.77252 12.2554 2.80608 12.37 2.87001L20.12 7.35001C20.2364 7.4136 20.3333 7.50771 20.4003 7.62224C20.4672 7.73676 20.5017 7.86736 20.5 8.00001V17C20.5006 17.1324 20.4657 17.2626 20.3988 17.3769C20.332 17.4913 20.2357 17.5856 20.12 17.65L12.37 22.12C12.2546 22.1738 12.1265 22.1945 12 22.18ZM5 16.52L12 20.57L19 16.52V8.44001L12 4.44001L5 8.44001V16.52Z" fill="#000000"/>
<path d="M12 16.66C11.9012 16.6623 11.8031 16.6438 11.7118 16.606C11.6205 16.5681 11.5382 16.5116 11.47 16.44L8.73 13.71C8.59131 13.5665 8.51379 13.3746 8.51379 13.175C8.51379 12.9754 8.59131 12.7836 8.73 12.64C8.87063 12.4996 9.06125 12.4207 9.26 12.4207C9.45875 12.4207 9.64938 12.4996 9.79 12.64L11.25 14.1V9.21002C11.25 9.01111 11.329 8.82034 11.4697 8.67969C11.6103 8.53904 11.8011 8.46002 12 8.46002C12.1989 8.46002 12.3897 8.53904 12.5303 8.67969C12.671 8.82034 12.75 9.01111 12.75 9.21002V15.91C12.7517 16.0592 12.7088 16.2055 12.6268 16.3302C12.5449 16.4549 12.4276 16.5523 12.29 16.61C12.1977 16.6459 12.099 16.6629 12 16.66Z" fill="#000000"/>
<path d="M12 16.66C11.9015 16.6605 11.8038 16.6412 11.7128 16.6035C11.6218 16.5657 11.5392 16.5101 11.47 16.44C11.3296 16.2994 11.2507 16.1087 11.2507 15.91C11.2507 15.7112 11.3296 15.5206 11.47 15.38L14.21 12.64C14.3506 12.4995 14.5413 12.4207 14.74 12.4207C14.9388 12.4207 15.1294 12.4995 15.27 12.64C15.4087 12.7836 15.4862 12.9754 15.4862 13.175C15.4862 13.3746 15.4087 13.5664 15.27 13.71L12.53 16.44C12.4608 16.5101 12.3782 16.5657 12.2872 16.6035C12.1962 16.6412 12.0985 16.6605 12 16.66Z" fill="#000000"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg
width="800px"
height="800px"
viewBox="0 0 24 24"
fill="none"
version="1.1"
id="svg3"
sodipodi:docname="com.ublinux.libublsettingsui-gtk3.arrow-down-ngon-symbolic.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs3" />
<sodipodi:namedview
id="namedview3"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="0.53625"
inkscape:cx="719.81352"
inkscape:cy="447.55245"
inkscape:window-width="1920"
inkscape:window-height="1056"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg3" />
<path
d="m 11.600722,23.993037 c -0.164762,0.0012 -0.326931,-0.0414 -0.469691,-0.123604 L 1.5517715,18.344365 C 1.4196641,18.265752 1.3088784,18.155869 1.229142,18.024355 1.1493931,17.892965 1.1031532,17.743899 1.0944391,17.590385 V 6.4660954 C 1.0924367,6.303631 1.1337573,6.1435524 1.2141365,6.0023479 1.2945158,5.8611434 1.4110614,5.7438933 1.5517715,5.6626736 L 11.131031,0.1252439 c 0.141648,-0.07901956 0.30122,-0.12050092 0.463512,-0.12050092 0.162291,0 0.321864,0.04148178 0.463512,0.12050092 l 9.579259,5.5374297 c 0.143875,0.078599 0.263645,0.1949224 0.346461,0.3364853 0.08269,0.1415505 0.125333,0.3029764 0.123232,0.4669365 V 17.590385 c 7.41e-4,0.163649 -0.04239,0.32458 -0.125088,0.46586 -0.08256,0.141401 -0.201597,0.25796 -0.344605,0.33756 l -9.579259,5.52507 c -0.142638,0.06649 -0.300975,0.0921 -0.457333,0.07416 z m -8.6522329,-6.995949 8.6522329,5.005935 8.652235,-5.005935 V 7.0099498 L 11.600722,2.0658164 2.9484891,7.0099498 Z"
fill="#000000"
id="path1"
style="stroke-width:1.23604" />
<path
d="m 11.600722,17.170132 c -0.122119,0.0028 -0.243374,-0.02003 -0.356223,-0.06674 -0.11286,-0.04684 -0.214577,-0.116683 -0.298875,-0.205183 L 7.5588938,13.523833 c -0.1714255,-0.17737 -0.2672429,-0.414565 -0.2672429,-0.661277 0,-0.246713 0.095816,-0.483785 0.2672429,-0.661278 0.1738233,-0.173539 0.4094361,-0.271062 0.6550978,-0.271062 0.2456619,0 0.4812857,0.09753 0.6550983,0.271062 l 1.8046081,1.80461 V 7.9617079 c 0,-0.2458593 0.09764,-0.4816573 0.271556,-0.6555056 0.173788,-0.173848 0.409622,-0.2715194 0.655468,-0.2715194 0.245847,0 0.481683,0.097672 0.655469,0.2715194 0.17391,0.1738483 0.271558,0.4096463 0.271558,0.6555056 v 8.2814001 c 0.0021,0.184415 -0.05091,0.365248 -0.15228,0.51938 -0.101233,0.154134 -0.246218,0.274524 -0.416296,0.345843 -0.114086,0.04437 -0.236083,0.06538 -0.358451,0.0618 z"
fill="#000000"
id="path2"
style="stroke-width:1.23604" />
<path
d="m 11.600722,17.170132 c -0.121749,6.18e-4 -0.242509,-0.02324 -0.354988,-0.06984 -0.112487,-0.04672 -0.214576,-0.115446 -0.30011,-0.202093 -0.173538,-0.173785 -0.27106,-0.409496 -0.27106,-0.655096 0,-0.245723 0.09753,-0.481313 0.27106,-0.655098 l 3.386733,-3.386732 c 0.173786,-0.173663 0.409497,-0.271062 0.655097,-0.271062 0.245724,0 0.481312,0.0974 0.655098,0.271062 0.171437,0.177493 0.267231,0.414565 0.267231,0.661278 0,0.246712 -0.0958,0.483784 -0.267231,0.661277 l -3.38673,3.374366 c -0.08554,0.08666 -0.18763,0.155371 -0.300112,0.202093 -0.112485,0.0466 -0.233237,0.07045 -0.354988,0.06984 z"
fill="#000000"
id="path3"
style="stroke-width:1.23604" />
</svg>

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

@ -1,14 +1,44 @@
<?xml version="1.0" ?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" id="SVGRoot" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<defs id="defs2"/>
<g id="layer1">
<path d="M 2,12 C 2,17.511 6.489,22 12,22 17.511,22 22,17.511 22,12 22,6.489 17.511,2 12,2 6.489,2 2,6.489 2,12 Z m 2,0 c 0,-4.43012 3.56988,-8 8,-8 4.43012,0 8,3.56988 8,8 0,4.43012 -3.56988,8 -8,8 -4.43012,0 -8,-3.56988 -8,-8 z m 4,0.9707 a 1,-1 0 0 0 0.29297,0.73633 l 2.98047,2.98047 0.0195,0.0195 a 1.0001,-1.0001 0 0 0 0.01,0.01 1,-1 0 0 0 0.0527,0.0469 1,-1 0 0 0 0.0664,0.0508 1,-1 0 0 0 0.0605,0.0391 1.0001,-1.0001 0 0 0 0.0273,0.0176 1,-1 0 0 0 0.0566,0.0293 1,-1 0 0 0 0.0723,0.0312 1.0001,-1.0001 0 0 0 0.0117,0.004 1,-1 0 0 0 0.0645,0.0234 1.0001,-1.0001 0 0 0 0.0352,0.008 1,-1 0 0 0 0.041,0.01 1.0001,-1.0001 0 0 0 0.0371,0.008 1,-1 0 0 0 0.043,0.008 1.0001,-1.0001 0 0 0 0.0723,0.006 1.0001,-1.0001 0 0 0 0.0449,0.002 1,-1 0 0 0 0.0117,0 1,-1 0 0 0 0.0293,-0.002 1.0001,-1.0001 0 0 0 0.0371,-0.002 1,-1 0 0 0 0.0508,-0.004 1.0001,-1.0001 0 0 0 0.0293,-0.004 1,-1 0 0 0 0.0762,-0.0137 1,-1 0 0 0 0.0586,-0.0156 1.0001,-1.0001 0 0 0 0.043,-0.0137 1,-1 0 0 0 0.0137,-0.004 1.0001,-1.0001 0 0 0 0.0703,-0.0293 1.0001,-1.0001 0 0 0 0.0664,-0.0332 1,-1 0 0 0 0.0273,-0.0137 1.0001,-1.0001 0 0 0 0.0449,-0.0293 1,-1 0 0 0 0.0215,-0.0137 1.0001,-1.0001 0 0 0 0.0332,-0.0234 1,-1 0 0 0 0.0215,-0.0176 1.0001,-1.0001 0 0 0 0.0547,-0.0469 1,-1 0 0 0 0.0215,-0.0195 1.0001,-1.0001 0 0 0 0.008,-0.008 1,-1 0 0 0 0.0391,-0.041 l 2.96094,-2.95898 a 1,-1 0 0 0 0,-1.41406 1,-1 0 0 0 -1.41407,0 L 13,13.58594 V 8 A 1,-1 0 0 0 12,7 1,-1 0 0 0 11,8 v 5.58594 L 9.70703,12.29297 a 1,-1 0 0 0 -1.41406,0 A 1,-1 0 0 0 8,12.9707 Z" id="path2488" style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"/>
<svg
width="800px"
height="800px"
viewBox="0 0 24 24"
id="SVGRoot"
version="1.1"
sodipodi:docname="com.ublinux.libublsettingsui-gtk3.arrow-down-round-symbolic.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="6.0669762"
inkscape:cx="408.4407"
inkscape:cy="756.55481"
inkscape:window-width="1920"
inkscape:window-height="1056"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="SVGRoot" />
<defs
id="defs2" />
<g
id="layer1"
transform="matrix(1.1983461,0,0,1.1983461,-2.3801537,-2.3957046)">
<path
d="M 2,12 C 2,17.511 6.489,22 12,22 17.511,22 22,17.511 22,12 22,6.489 17.511,2 12,2 6.489,2 2,6.489 2,12 Z m 2,0 c 0,-4.43012 3.56988,-8 8,-8 4.43012,0 8,3.56988 8,8 0,4.43012 -3.56988,8 -8,8 -4.43012,0 -8,-3.56988 -8,-8 z m 4,0.9707 a 1,1 0 0 0 0.29297,0.73633 l 2.98047,2.98047 0.0195,0.0195 a 1.0001,1.0001 0 0 0 0.01,0.01 1,1 0 0 0 0.0527,0.0469 1,1 0 0 0 0.0664,0.0508 1,1 0 0 0 0.0605,0.0391 1.0001,1.0001 0 0 0 0.0273,0.0176 1,1 0 0 0 0.0566,0.0293 1,1 0 0 0 0.0723,0.0312 1.0001,1.0001 0 0 0 0.0117,0.004 1,1 0 0 0 0.0645,0.0234 1.0001,1.0001 0 0 0 0.0352,0.008 1,1 0 0 0 0.041,0.01 1.0001,1.0001 0 0 0 0.0371,0.008 1,1 0 0 0 0.043,0.008 1.0001,1.0001 0 0 0 0.0723,0.006 1.0001,1.0001 0 0 0 0.0449,0.002 1,1 0 0 0 0.0117,0 1,1 0 0 0 0.0293,-0.002 1.0001,1.0001 0 0 0 0.0371,-0.002 1,1 0 0 0 0.0508,-0.004 1.0001,1.0001 0 0 0 0.0293,-0.004 1,1 0 0 0 0.0762,-0.0137 1,1 0 0 0 0.0586,-0.0156 1.0001,1.0001 0 0 0 0.043,-0.0137 1,1 0 0 0 0.0137,-0.004 1.0001,1.0001 0 0 0 0.0703,-0.0293 1.0001,1.0001 0 0 0 0.0664,-0.0332 1,1 0 0 0 0.0273,-0.0137 1.0001,1.0001 0 0 0 0.0449,-0.0293 1,1 0 0 0 0.0215,-0.0137 1.0001,1.0001 0 0 0 0.0332,-0.0234 1,1 0 0 0 0.0215,-0.0176 1.0001,1.0001 0 0 0 0.0547,-0.0469 1,1 0 0 0 0.0215,-0.0195 1.0001,1.0001 0 0 0 0.008,-0.008 1,1 0 0 0 0.0391,-0.041 l 2.96094,-2.95898 a 1,1 0 0 0 0,-1.41406 1,1 0 0 0 -1.41407,0 L 13,13.58594 V 8 A 1,1 0 0 0 12,7 1,1 0 0 0 11,8 v 5.58594 L 9.70703,12.29297 a 1,1 0 0 0 -1.41406,0 A 1,1 0 0 0 8,12.9707 Z"
id="path2488"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

@ -384,3 +384,7 @@ msgstr ""
#: source/libublsettingsui-gtk3.h:492
msgid "Exit"
msgstr ""
#: source/libublsettingsui-gtk3.h:493
msgid "Access to file denied"
msgstr ""

@ -391,3 +391,7 @@ msgstr "Изменения не сохранены ни в локальный,
#: source/libublsettingsui-gtk3.h:492
msgid "Exit"
msgstr "Выход"
#: source/libublsettingsui-gtk3.h:493
msgid "Access to file denied"
msgstr "Отказано в доступе к файлу"

@ -51,6 +51,7 @@ void on_file_chooser_selected(GtkWidget *self, filechooser_window *window){
(action == GTK_FILE_CHOOSER_ACTION_SAVE&&!yon_file_is_directory(data)) ||
(action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER&&yon_file_is_directory(data))
){
// gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(window->MainFileChooser),g_path_get_basename(data));
yon_char_parsed_add_or_create_if_exists(paths_success,&success_size,data);
}

@ -28,7 +28,7 @@ void _yon_saving_threaded(char *final_command){
int file_save;
config_str file_return = yon_config_load_file(file,&file_save);
fclose(file);
file_return = yon_char_parsed_append(file_return,&file_save,final_command);
file_return = yon_char_parsed_prepend(file_return,&file_save,final_command);
if (save_success_function)
{
struct save_return *data = malloc(sizeof(struct save_return));
@ -70,6 +70,13 @@ struct loaded_config *yon_save_window_get_saved_parameters(template_saving_windo
return final;
}
// struct __yon_save_section{
// int save_size;
// config_str save_config;
// int remove_size;
// config_str remove_config;
// } __yon_save_section;
config_str yon_loaded_config_convert_to_save_command(struct loaded_config *target, int *size,char *path){
(*size)=0;
@ -138,13 +145,24 @@ config_str yon_loaded_config_convert_to_save_command(struct loaded_config *targe
for_dictionaries(current,sections){
char *dull_command = NULL;
if (current->status>=0){
dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data);
dull_command = !commands?ubconfig_set_command_full(path,current->key,(char*)current->data):yon_char_unite("-- set ",current->key," ",(char*)current->data,NULL);
} else {
dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data);
dull_command = !commands?ubconfig_remove_command_full(path,current->key,(char*)current->data):yon_char_unite("-- remove ",current->key," ",(char*)current->data, NULL);
}
yon_char_parsed_add_or_create_if_exists(commands,size,dull_command);
free(dull_command);
}
// struct yon_temp_command_sections *current;
// for_dictionaries(current,sections){
// char *dull_command = NULL;
// if (current->status>=0){
// dull_command = ubconfig_set_command_full(path,current->key,(char*)current->data);
// } else {
// dull_command = ubconfig_remove_command_full(path,current->key,(char*)current->data);
// }
// yon_char_parsed_add_or_create_if_exists(commands,size,dull_command);
// free(dull_command);
// }
}
return commands;
}
@ -378,29 +396,38 @@ struct loaded_config *yon_config_convert_parameter(config_str parsed, int size){
for (int i=0;i<size;i++){
char *value = yon_char_new(parsed[i]);
char *key = yon_char_divide_search(value,"=",-1);
char *section = NULL;
if (key[0]=='['){
section = yon_char_divide_search(key," ",-1);
free(yon_char_divide(section,yon_char_find_last(section,'/')));
yon_char_remove_last_symbol(section,']');
}
if (!yon_char_is_empty(value)){
yon_char_remove_brackets(value);
}
if (!loaded){
loaded = (struct loaded_config*)malloc(sizeof(struct loaded_config));
loaded->key=key;
loaded->key=yon_char_new(key);
loaded->first=loaded;
loaded->next=NULL;
loaded->prev=NULL;
loaded->section=NULL;
loaded->data=value;
loaded->section=yon_char_new(section);
loaded->data=yon_char_new(value);
} else {
loaded->next = (struct loaded_config*)malloc(sizeof(struct loaded_config));
struct loaded_config *next=loaded->next;
next->first=loaded->first;
next->prev=loaded;
next->key=key;
next->key=yon_char_new(key);
next->first=loaded->first;
next->next=NULL;
next->section=NULL;
next->data=value;
next->section=yon_char_new(section);
next->data=yon_char_new(value);
loaded=next;
}
if (!yon_char_is_empty(value)) free(value);
if (!yon_char_is_empty(key)) free(key);
if (!yon_char_is_empty(section)) free(section);
}
return loaded;
}
@ -464,7 +491,7 @@ struct loaded_config *yon_config_get_compared(char *command){
if (config&&size>0){
for (int i=0;i<size;i++){
if (!yon_char_is_empty(config[i])&&strcmp(config[i],"(null)\n")){
if (config[i][strlen(config[i])-1]=='\n') config[i][strlen(config[i])-1]='\0';
yon_char_remove_last_symbol(config[i],'\n');
yon_char_parsed_add_or_create_if_exists(temporary,&temp_size,config[i]);
}
}
@ -473,17 +500,17 @@ struct loaded_config *yon_config_get_compared(char *command){
if (!temporary) return NULL;
struct loaded_config *loaded = yon_config_convert_parameter(temporary,temp_size);
int parsed_size;
config_str parsed_command = yon_char_parse(command,&parsed_size,";");
dictionary *sections = NULL;
for (int i=0;i<parsed_size;i++){
int dull_size;
yon_dictionary_add_or_create_if_exists_with_data(sections,yon_command_get_section(parsed_command[i]),yon_command_get_parameters(command,&dull_size));
}
// int parsed_size;
// config_str parsed_command = yon_char_parse(command,&parsed_size,";");
// dictionary *sections = NULL;
// for (int i=0;i<parsed_size;i++){
// int dull_size;
// yon_dictionary_add_or_create_if_exists_with_data(sections,yon_command_get_section(parsed_command[i]),yon_command_get_parameters(command,&dull_size));
// }
yon_loaded_config_set_sections_from_sections_dictionary(loaded,sections);
// yon_loaded_config_set_sections_from_sections_dictionary(loaded,sections);
yon_dictionary_free_all(sections,free);
// yon_dictionary_free_all(sections,free);
return loaded;
}
@ -543,7 +570,7 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
config_str commands = yon_loaded_config_convert_to_save_command(saved_parameters,&size,window->type!=YON_CONFIG_CUSTOM? yon_config_get_type_path(window->type):window->custom_save_path);
yon_config_parameter_prepare_elements(commands,&size);
char *final_command = yon_char_parsed_to_string(commands,size,";");
char *final_command = yon_char_parsed_to_string(commands,size," ");
char *new_str_closed = yon_char_replace(final_command,"\n","\\n");
if (presave_function)
@ -585,6 +612,11 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
if (!path&&type == YON_CONFIG_CUSTOM){
path = yon_custom_config_init(GTK_FILE_CHOOSER_ACTION_SAVE);
if (!path) return NULL;
if ((access(path,0)==F_OK&&access(path,4)!=F_OK)){
if (yon_status_box_is_set()){
yon_ubl_status_box_render(ACCESS_DENIED_LABEL(path),BACKGROUND_IMAGE_FAIL_TYPE);
}
}
}
va_list args;

@ -233,9 +233,19 @@ int yon_ubl_connect_config(_template_config *config){
return replaces;
}
gboolean on_window_delete (GtkWidget *, GdkEvent *,template_main_window *widgets){
gboolean on_window_delete (GtkWidget *self, GdkEvent *,template_main_window *){
template_saving_window *window = yon_exit_window_new();
if (window){
GCallback delete_callback = g_object_get_data(G_OBJECT(self),"exit_data_callback");
if (delete_callback){
((void(*)(template_saving_window*))delete_callback)(window);
GtkTreeIter iter;
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter)){
gtk_widget_destroy(window->Window);
free(window);
return 0;
}
}
gtk_widget_show(window->Window);
return 1;
}
@ -243,7 +253,12 @@ gboolean on_window_delete (GtkWidget *, GdkEvent *,template_main_window *widgets
}
void yon_window_remove_exit_config_check(template_main_window *widgets){
g_signal_handlers_disconnect_by_func(G_OBJECT(widgets->Window),G_CALLBACK(on_window_delete),widgets);
g_signal_handlers_disconnect_by_func(G_OBJECT(widgets->Window),G_CALLBACK(on_window_delete),NULL);
}
void yon_window_set_exit_config_check(template_main_window *widgets, GCallback data_callback_function){
g_signal_connect(G_OBJECT(widgets->Window),"delete-event",G_CALLBACK(on_window_delete),NULL);
g_object_set_data(G_OBJECT(widgets->Window),"exit_data_callback",data_callback_function);
}
template_main_window *setup_window(){
@ -318,7 +333,7 @@ template_main_window *setup_window(){
g_signal_connect(G_OBJECT(widgets->Window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),template_app_information.wiki_link);
g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),template_app_information.app_version);
g_signal_connect(G_OBJECT(widgets->Window),"delete-event",G_CALLBACK(on_window_delete),widgets);
g_signal_connect(G_OBJECT(widgets->Window),"delete-event",G_CALLBACK(on_window_delete),NULL);
if (yon_char_is_empty(__yon_config_mode)){
int size;

@ -325,6 +325,8 @@ void yon_ubl_settings_window_set_standard_callbacks(template_main_window *widget
void yon_window_remove_exit_config_check(template_main_window *widgets);
void yon_window_set_exit_config_check(template_main_window *widgets, GCallback data_callback_function);
typedef struct {
GtkWidget *Window;
GtkWidget *HeaderTopic;
@ -617,4 +619,5 @@ yon_password_window *yon_password_open(GtkEntry *target);
#define _EMPTY_IMPORTANT_LABEL yon_char_get_localised_from_lib("Empty important field!")
#define _INCORRECT_HASH_LABEL yon_char_get_localised_from_lib("Invalid hash")
#define _ENCRYPTION_DEFAULT_LABEL yon_char_get_localised_from_lib("Default (None)")
#define ACCESS_DENIED_LABEL(target) yon_char_unite(yon_char_get_localised_from_lib("Access to file denied"),": ", target,NULL)
#endif
Loading…
Cancel
Save