Saving fixes

pull/7/head
parent 1d2048aad5
commit 605bd3d712

@ -154,9 +154,7 @@
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Old value</property>
<child>
<object class="GtkCellRendererText">
<property name="wrap-width">250</property>
</object>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="cell-background">4</attribute>
<attribute name="sensitive">5</attribute>
@ -170,9 +168,7 @@
<property name="sizing">autosize</property>
<property name="title" translatable="yes">New value</property>
<child>
<object class="GtkCellRendererText">
<property name="wrap-width">250</property>
</object>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="cell-background">4</attribute>
<attribute name="sensitive">5</attribute>

@ -136,13 +136,26 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
free(final_command);
}
}
if (window->type == YON_CONFIG_GLOBAL)
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (window->type == YON_CONFIG_LOCAL)
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (window->type == YON_CONFIG_BOTH)
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
yon_window_config_custom_window_set(GTK_WINDOW(window->Window),"SaveWindow");
on_subwindow_close(self);
}
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
if (((type==YON_CONFIG_LOCAL&& template_config->load_mode==1)||(type==YON_CONFIG_GLOBAL&& template_config->load_mode==0))){
yon_config_save_registered(path);
return NULL;
if (type == YON_CONFIG_GLOBAL)
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (type == YON_CONFIG_LOCAL)
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (type == YON_CONFIG_BOTH)
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
} else {
char *config_to_save = NULL;
if (type==YON_CONFIG_GLOBAL) config_to_save="global";
@ -150,10 +163,8 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
else if (type==YON_CONFIG_BOTH) {
if (template_config->load_mode==1){
config_to_save="global";
yon_config_save_registered("system");
} else if (template_config->load_mode==0){
config_to_save="system";
yon_config_save_registered("global");
}
}
yon_config_set_status(0);
@ -269,22 +280,22 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
for (int i=0;i<compare_keys_size;i++){
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,0,1,compare_keys[i],5,1,-1);
for (int j=0;j<compare_size;j++){
if(config_compare[j][strlen(config_compare[j])-1]=='\n') config_compare[j][strlen(config_compare[j])-1]='\0';
char *compare_value = yon_char_new(config_compare[j]);
char *compare_name = yon_char_divide_search(compare_value,"=",-1);
if (!strcmp(compare_name,compare_keys[i])){ //&&strcmp((char*)yon_dictionary_get(&loaded.dict,compare_name)->data,compare_value)
char *cur_section = (char*)yon_dictionary_get(&loaded.dict->first,compare_keys[i])->prev->data;
gtk_list_store_set(window->list,&iter,2,compare_value,4,rgba_string,6,cur_section,-1);
for (int j=0;j<compare_size;j++){
if(config_compare[j][strlen(config_compare[j])-1]=='\n') config_compare[j][strlen(config_compare[j])-1]='\0';
char *compare_value = yon_char_new(config_compare[j]);
char *compare_name = yon_char_divide_search(compare_value,"=",-1);
if (!strcmp(compare_name,compare_keys[i])){ //&&strcmp((char*)yon_dictionary_get(&loaded.dict,compare_name)->data,compare_value)
char *cur_section = (char*)yon_dictionary_get(&loaded.dict->first,compare_keys[i])->prev->data;
gtk_list_store_set(window->list,&iter,2,compare_value,4,rgba_string,6,cur_section,-1);
}
free(compare_value);
free(compare_name);
}
free(compare_value);
free(compare_name);
if (yon_config_check_ignore(compare_keys[i])){
gtk_list_store_set(window->list,&iter,0,0,1,compare_keys[i],4,NULL,5,0,-1);
}
// if (!yon_config_check_ignore(compare_keys[i])){
// } else {
// }
}
char *name,*value;
for (int i=0;i<config_keys_size;i++){
@ -296,9 +307,15 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&name,2,&value,-1);
if (!yon_char_is_empty(name)&&!strcmp(name,config_keys[i])){
gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,-1);
if ((value&&!strcmp(value,compare_value))||yon_char_is_empty(compare_value)){
gtk_list_store_set(window->list,&iter,0,0,3,value,5,0,-1);
if (!yon_config_check_ignore(name)){
gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,-1);
if ((value&&!strcmp(value,compare_value))||yon_char_is_empty(compare_value)){
gtk_list_store_set(window->list,&iter,0,0,3,value,5,0,-1);
} else {
gtk_list_store_set(window->list,&iter,5,1,-1);
}
} else {
printf ("%s ignored\n",name);
}
found=1;
break;

Loading…
Cancel
Save