diff --git a/Makefile b/Makefile index 4d1977f..b21e3ae 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,7 @@ install: check clean: @echo "Clean ..." + @sed -r "s/^(project\(${PKGNAME} VERSION ).*/\10\)/" -i ${FILE_VER} @$(RM) -rd ${CMAKE_UI_BUILD_DIR} @$(RM) -rd ${CMAKE_UI_BUILD_DIR} @if [ -d ${CMAKE_UI_BUILD_DIR} ]; then \ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2ac6099..a985bc6 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.9) -project(libublsettingsui-gtk3 VERSION 0.0) +project(libublsettingsui-gtk3 VERSION 0) include(GNUInstallDirs) find_package(PkgConfig REQUIRED) diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index 588e30f..ffd1660 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -163,7 +163,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ loaded.dict = yon_dictionary_new(); dictionary *dct; 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); + 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*)); @@ -183,6 +183,32 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){ } } } + 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"); + 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'; + 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; + } + } + } + } GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_saving); template_saving_window *window = malloc(sizeof(template_saving_window)); window->Window = yon_gtk_builder_get_widget(builder,"Window"); @@ -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;iParametersTree)); 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,20 +249,21 @@ 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;ilist,&iter); - gtk_list_store_set(window->list,&iter,0,0,1,compare_keys[i],5,1,-1); - for (int j=0;jfirst,compare_keys[i])->prev->data; - gtk_list_store_set(window->list,&iter,2,compare_value,4,rgba_string,6,cur_section,-1); + 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;jfirst,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); } - } char *name,*value; for (int i=0;i