diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index f35182a..3731c0b 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -31,6 +31,7 @@ int yon_kernel_save(main_window *widgets){ } int yon_kernel_addon_save(main_window *widgets){ + yon_kernel_save(widgets); GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox)); char *install_modules = ""; for(GList *iter = list;iter;iter = iter->next){ @@ -44,7 +45,7 @@ int yon_kernel_addon_save(main_window *widgets){ if (!yon_char_is_empty(install_modules)){ char *parameter = config(modules_extra_parameter); - char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",install_modules,NULL); + char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?" ":"",install_modules,NULL); yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new); free(parameter_new); } @@ -246,6 +247,7 @@ int yon_pacman_software_save(main_window *widgets){ } void yon_pacman_init(main_window *widgets){ + gtk_list_store_clear(widgets->PacmanSoftwareChosenList); char *pacman_packages = config(packages_parameter); int size; diff --git a/source/ubinstall-gtk-keyboard.c b/source/ubinstall-gtk-keyboard.c index bd9d25c..da83e14 100644 --- a/source/ubinstall-gtk-keyboard.c +++ b/source/ubinstall-gtk-keyboard.c @@ -243,7 +243,7 @@ void yon_layout_build(char *key, GHashTable *value, main_window *widgets){ for (iterator=list;iterator;iterator=iterator->next){ if (!yon_char_is_empty((char*)iterator->data)){ gtk_tree_store_append(widgets->LayoutList,&iter,&parent); - gtk_tree_store_set(widgets->LayoutList,&iter,0,(char*)iterator->data,1,_((char*)g_hash_table_lookup(value,iterator->data)),2,1,3,0,4,1,-1); + gtk_tree_store_set(widgets->LayoutList,&iter,0,(char*)iterator->data,1,_((char*)g_hash_table_lookup(value,iterator->data)),2,1,3,0,4,0,-1); } } } @@ -314,12 +314,22 @@ void yon_keyboard_init(main_window *widgets){ gtk_tree_store_set(widgets->LayoutList,&iter,4,0,-1); } + for (int valid2 = gtk_tree_model_iter_children(model,&chiter,&iter);valid2;valid2 = gtk_tree_model_iter_next(model,&chiter)){ + gtk_tree_model_get(model,&chiter,0,&target,-1); + if (yon_char_parsed_check_exist(parsed,parsed_size,target)>-1){ + gtk_tree_store_set(widgets->LayoutList,&chiter,2,1,3,1,-1); + if (!strcmp(variant,target)){ + gtk_tree_store_set(widgets->LayoutList,&chiter,4,1,-1); + + } + } else { + gtk_tree_store_set(widgets->LayoutList,&chiter,3,0,4,0,-1); + } + } } else { gtk_tree_store_set(widgets->LayoutList,&iter,3,0,4,0,-1); } - for (int valid2 = gtk_tree_model_iter_children(model,&chiter,&iter);valid2;valid2 = gtk_tree_model_iter_next(model,&chiter)){ - } } } else { diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c index 5bf7785..e57eeda 100644 --- a/source/ubinstall-gtk-network.c +++ b/source/ubinstall-gtk-network.c @@ -210,6 +210,24 @@ int yon_network_save(main_window *widgets){ } else { yon_config_remove_by_key(NTPSERVERS_parameter); } + if (gtk_switch_get_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch))){ + int autohostname = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck)); + char *hostname = NULL; + if (autohostname) { + hostname = "auto"; + } else { + hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)); + } + if (yon_char_is_empty(hostname)){ + yon_ubl_status_box_render(EMPTY_IMPORTANT_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(widgets->HotnameEntry); + return 0; + } + yon_config_register(hostname_parameter,hostname_parameter_command,hostname); + } else { + yon_config_remove_by_key(hostname_parameter); + } + GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->NetworkConnectionsBox)); GList *iter; for (iter=list;iter;iter=iter->next){ @@ -284,36 +302,90 @@ void yon_network_init(main_window *widgets){ } yon_char_parsed_free(network_types,size); + char *domain = config(DOMAIN_parameter); + char *domain_admanger = config(DOMAIN_admanger_parameter); + char *ntp = config(NTPSERVERS_parameter); + char *hostname = config(hostname_parameter); + + if (!yon_char_is_empty(domain)){ + gtk_switch_set_active(GTK_SWITCH(widgets->NetworkDomainSwitch),1); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkDomainNameEntry),domain); + if (!yon_char_is_empty(domain_admanger)){ + char *domain_password = yon_char_new(domain_admanger); + char *domain_admin = yon_char_divide_search(domain_password,":",-1); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkDomainAdminEntry),domain_admin); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkDomainPasswordEntry),domain_password); + } + } + if (!yon_char_is_empty(ntp)){ + gtk_switch_set_active(GTK_SWITCH(widgets->NetworkNTPServerSwitch),1); + gtk_widget_set_sensitive(widgets->NetworkNTPEntry,0); + if (!strcmp(ntp,"dhcp")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),1); + } else if (!strcmp(ntp,"default")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),2); + } else if (!strcmp(ntp,"ntp-ru")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),3); + } else if (!strcmp(ntp,"no")||!strcmp(ntp,"disable")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),5); + } else if (!strcmp(ntp,"stop")){ + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),6); + } else { + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),4); + gtk_widget_set_sensitive(widgets->NetworkNTPEntry,1); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),ntp); + } + } else { + gtk_widget_set_sensitive(widgets->NetworkNTPEntry,0); + gtk_entry_set_text(GTK_ENTRY(widgets->NetworkNTPEntry),""); + gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->NetworkNTPCombo),0); + } + gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),""); + if (!yon_char_is_empty(hostname)){ + gtk_switch_set_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch),1); + if (!strcmp(hostname,"auto")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),1); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0); + gtk_entry_set_text(GTK_ENTRY(widgets->HotnameEntry),hostname); + } + } config_str parameters = yon_config_get_all_by_key(NETWORK_parameter_search,&size); for (int i=0;iNetworkConnectionsBox),info->MainBox,0,0,0); gtk_widget_show(info->MainBox); int connection_size; config_str connection = yon_char_parse(parameter,&connection_size," "); - for (int k=0;kAutoGetIPSwitch),0); - } else if (!strcmp(connection[k],"ipv4.addr")){ - char *mask = yon_char_new(connection[++k]); - char *ip = yon_char_divide_search(mask,"/",-1); - gtk_entry_set_text(GTK_ENTRY(info->MaskEntry),mask); - gtk_entry_set_text(GTK_ENTRY(info->IpAdressEntry),ip); - free(mask); - free(ip); - - } else if (!strcmp(connection[k],"ipv4.gateway")){ - gtk_entry_set_text(GTK_ENTRY(info->GatewayEntry),connection[++k]); + if (yon_char_parsed_check_exist(connection,connection_size,"ipv4.method")>-1){ + gtk_switch_set_active(GTK_SWITCH(info->AutoGetIPSwitch),1); + } else { + int addr_active = yon_char_parsed_check_exist(connection,connection_size,"ipv4.addr"); + if (addr_active>-1){ + char *mask = yon_char_new(connection[addr_active+1]); + char *ip = yon_char_divide_search(mask,"/",-1); + gtk_entry_set_text(GTK_ENTRY(info->MaskEntry),mask); + gtk_entry_set_text(GTK_ENTRY(info->IpAdressEntry),ip); + free(mask); + free(ip); + } + addr_active = yon_char_parsed_check_exist(connection,connection_size,"ipv4.gateway"); + if (addr_active>-1){ + gtk_entry_set_text(GTK_ENTRY(info->GatewayEntry),connection[addr_active+1]); - } else if (!strcmp(connection[k],"ipv4.dns")){ - gtk_entry_set_text(GTK_ENTRY(info->DNSEntry),connection[++k]); + } + addr_active = yon_char_parsed_check_exist(connection,connection_size,"ipv4.dns"); + if (addr_active>-1){ + gtk_entry_set_text(GTK_ENTRY(info->DNSEntry),connection[addr_active+1]); } } @@ -321,9 +393,9 @@ void yon_network_init(main_window *widgets){ GList *list = g_hash_table_get_keys(main_config.network_types); GList *iter; for (iter=list;iter;iter=iter->next){ - if (g_hash_table_contains(g_hash_table_lookup(main_config.network_types,(char*)iter->data),key)){ + if (g_hash_table_contains(g_hash_table_lookup(main_config.network_types,(char*)iter->data),key_type)){ gtk_combo_box_set_active_id(GTK_COMBO_BOX(info->TypeCombo),(char*)iter->data); - gtk_combo_box_set_active_id(GTK_COMBO_BOX(info->ConnectionCombo),key); + gtk_combo_box_set_active_id(GTK_COMBO_BOX(info->ConnectionCombo),key_type); break; } } diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 8b4635e..81cf723 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -115,7 +115,7 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){ return yon_os_components_save(widgets); break; case YON_PAGE_KERNEL: - return yon_kernel_save(widgets); + // return yon_kernel_save(widgets); break; case YON_PAGE_KERNEL_ADDON: return yon_kernel_addon_save(widgets); diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 553573d..60dd33b 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -14,9 +14,9 @@ // free(result); // } -// void yon_save_proceed(char *path, YON_CONFIG_TYPE type){ -// yon_debug_output("%s\n",yon_config_save_simple(type,path)); -// } +void yon_config_save_proceed(char *path, YON_CONFIG_TYPE type){ + yon_debug_output("%s\n",yon_config_save_simple(type,path)); +} void yon_load_proceed(YON_CONFIG_TYPE type){ if (type!=YON_CONFIG_CUSTOM){ @@ -76,22 +76,22 @@ void on_config_custom_load(GtkWidget *,main_window *widgets){ main_config.load_mode=YON_CONFIG_CUSTOM; } -// void on_config_global_local_save(GtkWidget *,main_window *widgets){ -// yon_save_proceed(NULL,YON_CONFIG_BOTH); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// } +void on_config_global_local_save(GtkWidget *,main_window *widgets){ + yon_config_save_proceed(NULL,YON_CONFIG_BOTH); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); +} -// void on_config_local_save(GtkWidget *,main_window *widgets){ -// yon_save_proceed("system",YON_CONFIG_LOCAL); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// -// } +void on_config_local_save(GtkWidget *,main_window *widgets){ + yon_config_save_proceed("system",YON_CONFIG_LOCAL); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// void on_config_global_save(GtkWidget *,main_window *widgets){ -// yon_save_proceed("global",YON_CONFIG_GLOBAL); -// gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); -// -// } +} + +void on_config_global_save(GtkWidget *,main_window *widgets){ + yon_config_save_proceed("global",YON_CONFIG_GLOBAL); + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETED); + +} // void on_config_custom_save(GtkWidget *, main_window *widgets){ // char *path = NULL; diff --git a/source/ubinstall-gtk-startup-services.c b/source/ubinstall-gtk-startup-services.c index 2355619..2c5ee87 100644 --- a/source/ubinstall-gtk-startup-services.c +++ b/source/ubinstall-gtk-startup-services.c @@ -76,11 +76,13 @@ void yon_startup_services_setup(main_window *widgets){ int pos = yon_char_parsed_check_exist(parsed,parsed_size,target_parsed[i]); if (pos>-1){ found++; - parsed = yon_char_parsed_rip(parsed,&parsed_size,pos); + parsed = yon_char_parsed_rip(parsed,&parsed_size,pos); } } if (found == target_size){ gtk_list_store_set(widgets->StartupList,&iter,0,1,-1); + } else { + gtk_list_store_set(widgets->StartupList,&iter,0,0,-1); } yon_char_parsed_free(target_parsed,target_size); } else { diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index b4debc9..b192da8 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -186,11 +186,11 @@ layout && /description:/ {\ #define packages_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[packages]" #define device_typevfs_parameter "AUTOINSTALL[device_typevfs]" #define device_typevfs_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_typevfs]" -#define NTPSERVERS_parameter "AOUTINSTALL[ubconfig set [network] NTPSERVERS]" +#define NTPSERVERS_parameter "AUTOINSTALL[ubconfig set [network] NTPSERVERS]" #define NTPSERVERS_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] NTPSERVERS']" -#define DOMAIN_parameter "AOUTINSTALL[ubconfig set [network] DOMAIN]" +#define DOMAIN_parameter "AUTOINSTALL[ubconfig set [network] DOMAIN]" #define DOMAIN_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN']" -#define DOMAIN_admanger_parameter "AOUTINSTALL[ubconfig set [network] DOMAIN[admanger]]" +#define DOMAIN_admanger_parameter "AUTOINSTALL[ubconfig set [network] DOMAIN[admanger]]" #define DOMAIN_admanger_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN[admanger]']" #define USERADD_parameter_all "AUTOINSTALL[ubconfig set [users] USERADD[*]]" #define USERADD_parameter_search "AUTOINSTALL[ubconfig set [users] USERADD["