|
|
|
|
@ -162,6 +162,27 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
struct loaded_config loaded;
|
|
|
|
|
loaded.dict = yon_dictionary_new();
|
|
|
|
|
dictionary *dct;
|
|
|
|
|
for_dictionaries(dct,section_commands){
|
|
|
|
|
char *command = yon_char_unite(ubconfig_load_command," default get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL);
|
|
|
|
|
FILE *output = popen(command, "r");
|
|
|
|
|
char **output_strings = NULL;
|
|
|
|
|
output_strings = malloc(sizeof(char*));
|
|
|
|
|
int i = 0;
|
|
|
|
|
char str[4096];
|
|
|
|
|
memset(str, 0, 4096);
|
|
|
|
|
while (fgets(str, 4096, output))
|
|
|
|
|
{
|
|
|
|
|
if (!yon_char_is_empty(str)&& strcmp(str,"(null)\n")!=0)
|
|
|
|
|
{
|
|
|
|
|
char *final_str = yon_char_new(str);
|
|
|
|
|
char *key =yon_char_divide_search(final_str,"=",-1);
|
|
|
|
|
if (final_str[strlen(final_str)-1]=='\n')final_str[strlen(final_str)-1]='\0';
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,NULL,yon_char_new(dct->key));
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,key,yon_char_new(final_str));
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(config_compare,&compare_size,yon_char_new(str));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for_dictionaries(dct,section_commands){
|
|
|
|
|
char *command = yon_char_unite(ubconfig_load_command," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL);
|
|
|
|
|
FILE *output = popen(command, "r");
|
|
|
|
|
@ -177,9 +198,14 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
char *final_str = yon_char_new(str);
|
|
|
|
|
char *key =yon_char_divide_search(final_str,"=",-1);
|
|
|
|
|
if (final_str[strlen(final_str)-1]=='\n')final_str[strlen(final_str)-1]='\0';
|
|
|
|
|
dictionary *found=NULL;
|
|
|
|
|
if (!(found=yon_dictionary_get(&loaded.dict,dct->key))){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,NULL,yon_char_new(dct->key));
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,key,yon_char_new(final_str));
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(config_compare,&compare_size,yon_char_new(str));
|
|
|
|
|
} else{
|
|
|
|
|
loaded.dict->data = final_str;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -195,19 +221,17 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
window->ToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleCell"));
|
|
|
|
|
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
|
|
|
|
|
window->type=type;
|
|
|
|
|
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"SaveWindow");
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
|
|
|
|
|
GList *list = gtk_tree_view_get_columns(GTK_TREE_VIEW(window->ParametersTree));
|
|
|
|
|
for (int i=0;i<g_list_length(list);i++){
|
|
|
|
|
yon_gtk_column_minimal_fixed_size_set((GtkTreeViewColumn*)g_list_nth_data(list,i));
|
|
|
|
|
}
|
|
|
|
|
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(window->ParametersTree));
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked", G_CALLBACK(on_save_parameters),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ToggleCell),"toggled", G_CALLBACK(on_save_window_parameter_switched),window);
|
|
|
|
|
int config_size=0;
|
|
|
|
|
config_str config_strings = yon_config_get_all(&config_size);
|
|
|
|
|
config_str config_strings = yon_config_get_all_no_ignored(&config_size);
|
|
|
|
|
if (config_strings){
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),NULL);
|
|
|
|
|
@ -216,7 +240,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
int compare_keys_size=compare_size;
|
|
|
|
|
yon_char_parsed_divide_search_full(compare_keys,compare_keys_size,"=",-1);
|
|
|
|
|
int config_keys_size=0;
|
|
|
|
|
config_str config_keys = yon_config_get_all_keys(&config_keys_size);
|
|
|
|
|
config_str config_keys = yon_config_get_all_keys_no_ignored(&config_keys_size);
|
|
|
|
|
int final_size=0;
|
|
|
|
|
GdkRGBA rgba;
|
|
|
|
|
rgba.alpha=0.8;
|
|
|
|
|
@ -225,6 +249,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
rgba.green=0.65;
|
|
|
|
|
char *rgba_string = gdk_rgba_to_string(&rgba);
|
|
|
|
|
for (int i=0;i<compare_keys_size;i++){
|
|
|
|
|
if (!yon_config_check_ignore(compare_keys[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++){
|
|
|
|
|
@ -238,7 +263,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
|
|
|
|
|
free(compare_value);
|
|
|
|
|
free(compare_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char *name,*value;
|
|
|
|
|
for (int i=0;i<config_keys_size;i++){
|
|
|
|
|
|