diff --git a/gresource.xml b/gresource.xml
index fb7213e..11c7f36 100644
--- a/gresource.xml
+++ b/gresource.xml
@@ -13,6 +13,8 @@
ubinstall-gtk-menu-item.glade
ubinstall-gtk-kernel-row.glade
ubinstall-gtk-service-window.glade
+ ubinstall-gtk-bootloader-user.glade
+ ubinstall-gtk-network-box.glade
ubinstall-gtk.css
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index cbb8ef1..f7b276d 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -70,6 +70,8 @@ set(DEPENDFILES
../ubinstall-gtk-menu-item.glade
../ubinstall-gtk-kernel-row.glade
../ubinstall-gtk-service-window.glade
+ ../ubinstall-gtk-bootloader-user.glade
+ ../ubinstall-gtk-network-box.glade
../gresource.xml
../ubinstall-gtk.css
../modules.csv
diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c
index 0d19168..dc5bdc4 100644
--- a/source/ubinstall-gtk-bootloader.c
+++ b/source/ubinstall-gtk-bootloader.c
@@ -2,29 +2,163 @@
int yon_bootloader_save(main_window *widgets){
if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadTimerSwitch))){
- // long time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin));
- // yon_config_register(,,yon_char_from_long(time));
+ long time = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin));
+ yon_config_register(GRUB_TIMEOUT_parameter,GRUB_TIMEOUT_parameter_command,yon_char_from_long(time));
+ } else {
+ yon_config_remove_by_key(GRUB_TIMEOUT_parameter);
}
char *OS = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry));
if (strcmp(OS,DEFAULT_BOOTLOAD_MENU_ITEM_LABEL)){
- // yon_config_register(,,OS);
+ yon_config_register(GRUB_DEFAULT_parameter,GRUB_DEFAULT_parameter_command,OS);
} else {
- // yon_config_remove_by_key();
+ yon_config_remove_by_key(GRUB_DEFAULT_parameter);
}
if (gtk_switch_get_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch))){
GtkTreeIter iter;
+ yon_config_register(AUTOLOGINUSER_parameter,AUTOLOGINUSER_parameter_command,"yes");
GtkTreeModel *model = GTK_TREE_MODEL(widgets->BootloadUsersList);
+ int admin_size=0;
+ config_str admin_list = NULL;
for_iter(model,&iter){
int is_admin;
char *username, *password;
gtk_tree_model_get(model,&iter,0,&is_admin,1,&username,2,&password,-1);
- // yon_config_register(,,);
+ if (is_admin){
+ yon_char_parsed_add_or_create_if_exists(admin_list,&admin_size,username);
+ }
+ char *admin_string = yon_char_parsed_to_string(admin_list,admin_size,",");
+ yon_config_register(GRUB_PASSWORD_parameter(username),GRUB_PASSWORD_parameter_command(username),password);
+ yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,admin_string);
+ free(admin_string);
}
} else {
- // yon_config_remove_by_key();
+ int size;
+ config_str users = yon_config_get_all_by_key(GRUB_PASSWORD_parameter_search,&size);
+ for (int i=0;iPasswordEntry);
+ yon_password_window *dialog = yon_password_open(output_target);
+ yon_gtk_window_setup(GTK_WINDOW(dialog->Window),GTK_WINDOW(window->Window),NULL,icon_path,"password_window");
+ gtk_widget_show(window->Window);
+
+}
+
+void on_bootloader_user_accept(GtkWidget *, bootloader_user_window *window){
+ main_window *widgets = g_object_get_data(G_OBJECT(window->AcceptButton),"widgets");
+ const char *username = gtk_entry_get_text(GTK_ENTRY(window->UsernameEntry));
+
+ if (yon_char_is_empty(window->prev_name)){
+ GtkTreeIter iter;
+ GtkTreeModel *model = GTK_TREE_MODEL(widgets->BootloadUsersList);
+ for_iter(model,&iter){
+ char *name;
+ gtk_tree_model_get(model,&iter,1,&name,-1);
+ if (!strcmp(name,username)){
+ dialog_confirmation_data *data = yon_confirmation_dialog_data_new();
+ data->action_text = BOOTLOADER_USER_EXIST_LABEL(username);
+ if (yon_confirmation_dialog_call(window->Window,data)!=GTK_RESPONSE_ACCEPT){
+ return;
+ }
+ }
+ }
+ }
+ const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry));
+ if (yon_char_is_empty(username)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->UsernameEntry);
+ return;
+ }
+ if (yon_char_is_empty(password)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(window->PasswordEntry);
+ return;
+ }
+ if (!yon_char_is_empty(window->prev_name)&&strcmp(username,window->prev_name)){
+ yon_config_remove_by_key(GRUB_PASSWORD(window->prev_name));
+ int size;
+ char *superusers = config(GRUB_SUPERUSERS_parameter);
+ config_str parsed = yon_char_parse(superusers,&size,",");
+ int pos = yon_char_parsed_check_exist(parsed,size,(char*)username);
+ if (pos>-1){
+ parsed = yon_char_parsed_rip(parsed,&size,pos);
+ char *superusers = yon_char_parsed_to_string(parsed,size,",");
+ if (!yon_char_is_empty(superusers)){
+ yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,superusers);
+ } else {
+ yon_config_remove_by_key(GRUB_SUPERUSERS_parameter);
+ }
+ }
+ }
+ yon_config_register(GRUB_PASSWORD(username),GRUB_SUPERUSERS_parameter_command,(char*)password);
+ GtkTreeIter iter;
+ gtk_list_store_append(widgets->BootloadUsersList,&iter);
+ gtk_list_store_set(widgets->BootloadUsersList,&iter,0,gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->AdminCheck)),1,username,2,"******",-1);
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->AdminCheck))){
+ int size;
+ char *superusers = config(GRUB_SUPERUSERS_parameter);
+ config_str parsed = yon_char_parse(superusers,&size,",");
+ if (yon_char_parsed_check_exist(parsed,size,(char*)username)==-1){
+ yon_char_parsed_add_or_create_if_exists(parsed,&size,(char*)username);
+ char *superusers = yon_char_parsed_to_string(parsed,size,",");
+ yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,superusers);
+ }
+ } else {
+ int size;
+ char *superusers = config(GRUB_SUPERUSERS_parameter);
+ config_str parsed = yon_char_parse(superusers,&size,",");
+ int pos = yon_char_parsed_check_exist(parsed,size,(char*)username);
+ if (pos!=-1){
+ parsed = yon_char_parsed_rip(parsed,&size,pos);
+
+ char *superusers = yon_char_parsed_to_string(parsed,size,",");
+ yon_config_register(GRUB_SUPERUSERS_parameter,GRUB_SUPERUSERS_parameter_command,superusers);
+ }
+ }
+ on_subwindow_close(window->Window);
+}
+
+bootloader_user_window *yon_bootloader_user_window_new(){
+ bootloader_user_window *window = new(bootloader_user_window);
+
+ GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_bootloader_user);
+
+ window->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
+ window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox");
+ window->TitleLabel = yon_gtk_builder_get_widget(builder,"TitleLabel");
+ window->AdminCheck = yon_gtk_builder_get_widget(builder,"AdminCheck");
+ window->UsernameEntry = yon_gtk_builder_get_widget(builder,"UsernameEntry");
+ window->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry");
+ window->PasswordButton = yon_gtk_builder_get_widget(builder,"PasswordButton");
+ window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
+ window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
+ window->prev_name = NULL;
+
+ g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
+ g_signal_connect(G_OBJECT(window->PasswordButton),"clicked",G_CALLBACK(yon_password_change),window);
+ yon_gtk_entry_set_password_visibility_icon(GTK_ENTRY(window->PasswordEntry));
+ yon_gtk_entry_block_restricted_symbols(GTK_ENTRY(window->UsernameEntry));
+ return window;
+}
+
+void on_bootloader_user_add(GtkWidget *, main_window *widgets){
+ bootloader_user_window *window = yon_bootloader_user_window_new();
+ g_object_set_data(G_OBJECT(window->AcceptButton),"widgets",widgets);
+ g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_bootloader_user_accept),window);
+ yon_gtk_window_setup(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow),NULL,icon_path,"bootloader_window");
+ gtk_widget_show(window->Window);
+}
+
void on_menu_chosen(GtkWidget *, yon_menu_item *item){
if (strcmp(item->target,DEFAULT_MENU_ITEM_LABEL)){
gtk_entry_set_text(GTK_ENTRY(item->widgets->BootloadDefaultOSEntry),item->target);
@@ -230,4 +364,42 @@ yon_menu_item *yon_menu_item_new(){
item->children=NULL;
return item;
-}
\ No newline at end of file
+}
+
+void yon_bootloader_interface_update(main_window *widgets){
+ char *timeout = config(GRUB_TIMEOUT_parameter);
+ char *admins = config(GRUB_SUPERUSERS_parameter);
+ char *autologin = config(AUTOLOGINUSER_parameter);
+ char *os = config(GRUB_DEFAULT_parameter);
+ int size;
+ config_str users = yon_config_get_all_by_key(GRUB_PASSWORD_parameter_search,&size);
+ if (!yon_char_is_empty(timeout)){
+ long timeout_l = atol(timeout);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widgets->BootloadTimerSpin),timeout_l);
+ }
+ if (!yon_char_is_empty(os)){
+ gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),os);
+ } else {
+ gtk_entry_set_text(GTK_ENTRY(widgets->BootloadDefaultOSEntry),DEFAULT_MENU_ITEM_LABEL);
+ }
+ if (!yon_char_is_empty(autologin)&&(!strcmp(autologin,"yes")||!strcmp(autologin,"enable"))){
+ gtk_switch_set_active(GTK_SWITCH(widgets->BootloadNoPasswordSwitch),1);
+ } else {
+ int admins_size;
+ config_str admins_parsed = yon_char_parse(admins,&admins_size,",");
+ for (int i=0;iBootloadUsersList,&iter);
+ gtk_list_store_set(widgets->BootloadUsersList,&iter,0,yon_char_parsed_check_exist(admins_parsed,admins_size,key),1,key,2,value,-1);
+ }
+ }
+
+}
+
+// void yon_bootloader_setup(main_window *widgets){
+
+// }
\ No newline at end of file
diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c
index 5014639..fed11dd 100644
--- a/source/ubinstall-gtk-components.c
+++ b/source/ubinstall-gtk-components.c
@@ -14,7 +14,6 @@ int yon_kernel_save(main_window *widgets){
enabled_module = row->package;
}
}
-
}
if (!yon_char_is_empty(install_modules)){
@@ -24,7 +23,27 @@ int yon_kernel_save(main_window *widgets){
}
yon_config_register(KERNEL_BOOT_parameter,KERNEL_BOOT_parameter_command,enabled_module);
return 1;
-
+}
+
+int yon_kernel_addon_save(main_window *widgets){
+ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelAddonListBox));
+ char *install_modules = "";
+ for(GList *iter = list;iter;iter = iter->next){
+ kernel_row *row = g_object_get_data(G_OBJECT(iter->data),"kernel_row");
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->InstallCheck))){
+ char *temp = yon_char_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL);
+ if (!yon_char_is_empty(install_modules)) free(install_modules);
+ install_modules = temp;
+ }
+ }
+
+ 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);
+ yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new);
+ free(parameter_new);
+ }
+ return 1;
}
int yon_os_components_save(main_window *widgets){
@@ -66,9 +85,10 @@ int yon_software_save(main_window *widgets){
}
if (size){
char *final = yon_char_parsed_to_string(modules,size,",");
- yon_config_register(modules_extra_parameter,modules_extra_parameter_command,final);
- } else {
- yon_config_remove_by_key(modules_extra_parameter);
+ char *parameter = config(modules_extra_parameter);
+ char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",final,NULL);
+ yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new);
+ free(parameter_new);
}
return 1;
}
@@ -86,9 +106,10 @@ int yon_pacman_software_save(main_window *widgets){
char *final = yon_char_parsed_to_string(parameters,size,",");
yon_char_parsed_free(parameters,size);
if (!yon_char_is_empty(final)){
- yon_config_register(packages_parameter,packages_parameter_command,final);
- } else {
- yon_config_remove_by_key(packages_parameter);
+ char *parameter = config(modules_extra_parameter);
+ char *parameter_new = yon_char_unite(!yon_char_is_empty(parameter)?parameter:"",!yon_char_is_empty(parameter)?",":"",final,NULL);
+ yon_config_register(modules_extra_parameter,modules_extra_parameter_command,parameter_new);
+ free(parameter_new);
}
return 1;
}
\ No newline at end of file
diff --git a/source/ubinstall-gtk-network.c b/source/ubinstall-gtk-network.c
index 877a371..3fcc610 100644
--- a/source/ubinstall-gtk-network.c
+++ b/source/ubinstall-gtk-network.c
@@ -1,33 +1,33 @@
#include "ubinstall-gtk.h"
-// void on_autohostname_check(GtkWidget *, main_window *widgets){
-// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1);
-// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){
-// gtk_widget_set_sensitive(widgets->HotnameEntry,0);
-// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto");
-// }else{
-// gtk_widget_set_sensitive(widgets->HotnameEntry,1);
-// gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install");
-// }
-// }
+void on_autohostname_check(GtkWidget *, main_window *widgets){
+ gtk_switch_set_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch),1);
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){
+ gtk_widget_set_sensitive(widgets->HotnameEntry,0);
+ gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"auto");
+ }else{
+ gtk_widget_set_sensitive(widgets->HotnameEntry,1);
+ gtk_entry_set_placeholder_text(GTK_ENTRY(widgets->HotnameEntry),"ublinux-install");
+ }
+}
-// void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){
-// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck))){
-// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1);
-// if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){
-// gtk_widget_set_sensitive(widgets->HotnameEntry,0);
-// } else
-// gtk_widget_set_sensitive(widgets->HotnameEntry,1);
-// } else {
-// gtk_widget_set_sensitive(widgets->HotnameEntry,0);
-// gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0);
-// }
-// }
+void on_autohostname_sensitiveness_check(GtkWidget *, main_window *widgets){
+ if (gtk_switch_get_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch))){
+ gtk_widget_set_sensitive(widgets->AutoHostnameCheck,1);
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck))){
+ gtk_widget_set_sensitive(widgets->HotnameEntry,0);
+ } else
+ gtk_widget_set_sensitive(widgets->HotnameEntry,1);
+ } else {
+ gtk_widget_set_sensitive(widgets->HotnameEntry,0);
+ gtk_widget_set_sensitive(widgets->AutoHostnameCheck,0);
+ }
+}
-// void on_hostname_entry_changed (GtkWidget *, main_window *widgets){
-// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),1);
-// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0);
-// }
+void on_hostname_entry_changed (GtkWidget *, main_window *widgets){
+ gtk_switch_set_active(GTK_SWITCH(widgets->HostnameSensitiveSwitch),1);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutoHostnameCheck),0);
+}
network_info *yon_network_info_new(){
network_info *info = new(network_info);
@@ -47,6 +47,22 @@ network_info *yon_network_info_new(){
g_object_set_data(G_OBJECT(info->RemoveButton),"network_info",info);
g_object_set_data(G_OBJECT(info->MainBox),"network_info",info);
+ yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->IpAdressEntry),"01234567890.");
+ yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->MaskEntry),"01234567890.");
+ yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->GatewayEntry),"01234567890.");
+ yon_on_entry_set_allowed_symbols(GTK_ENTRY(info->DNSEntry),"01234567890.");
+
+ yon_entry_set_pattern(GTK_ENTRY(info->IpAdressEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$");
+ yon_entry_set_pattern(GTK_ENTRY(info->MaskEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$");
+ yon_entry_set_pattern(GTK_ENTRY(info->GatewayEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$");
+ yon_entry_set_pattern(GTK_ENTRY(info->DNSEntry),"^(\\d{0,3})(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?(\\.(\\d{0,3}))?$");
+
+ g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->IpAdressEntry);
+ g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->GatewayEntry);
+ g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->MaskEntry);
+ g_signal_connect(G_OBJECT(info->AutoGetIPSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),info->DNSEntry);
+
+
gtk_widget_show(info->MainBox);
return info;
}
@@ -101,9 +117,10 @@ void on_ntp_sync(GtkWidget *, main_window *widgets){
}
}
-void on_connection_add(main_window *widgets){
+void on_connection_add(GtkWidget *,main_window *widgets){
network_info *info = yon_network_info_new();
gtk_box_pack_start(GTK_BOX(widgets->NetworkConnectionsBox),info->MainBox,0,0,0);
+ gtk_widget_show(info->MainBox);
}
int yon_network_save(main_window *widgets){
@@ -167,5 +184,47 @@ int yon_network_save(main_window *widgets){
} else {
yon_config_remove_by_key(NTPSERVERS_parameter);
}
+ GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->NetworkConnectionsBox));
+ GList *iter;
+ for (iter=list;iter;iter=iter->next){
+ network_info *info = g_object_get_data(G_OBJECT(iter->data),"network_info");
+ // char *type = gtk_combo_box_get_active_id(GTK_COMBO_BOX(info->TypeCombo));
+ char *connection = (char*)gtk_entry_get_text(GTK_ENTRY(info->ConnectionEntry));
+ // int active = gtk_switch_get_active(GTK_SWITCH(info->EnabledSwitch));
+ if (!gtk_switch_get_active(GTK_SWITCH(info->AutoGetIPSwitch))){
+ char *ip = (char*)gtk_entry_get_text(GTK_ENTRY(info->IpAdressEntry));
+ char *mask = (char*)gtk_entry_get_text(GTK_ENTRY(info->MaskEntry));
+ char *gateway = (char*)gtk_entry_get_text(GTK_ENTRY(info->GatewayEntry));
+ char *dns = (char*)gtk_entry_get_text(GTK_ENTRY(info->DNSEntry));
+ if (!yon_ip_check(ip)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(info->IpAdressEntry);
+ return 0;
+ }
+ if (!yon_ip_check(mask)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(info->MaskEntry);
+ return 0;
+ }
+ if (!yon_ip_check(gateway)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(info->GatewayEntry);
+ return 0;
+ }
+ if (!yon_ip_check(dns)){
+ yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),WRONG_IP_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
+ yon_ubl_status_highlight_incorrect(info->DNSEntry);
+ return 0;
+ }
+
+ int bitmask = yon_ip_mask_get_bits(mask);
+ mask = yon_char_from_int(bitmask);
+ char *value = network_value(ip,mask,gateway,dns);
+ yon_config_register(NETWORK_parameter(connection),NETWORK_parameter_command(connection),value);
+ } else {
+ yon_config_register(NETWORK_parameter(connection),NETWORK_parameter_command(connection),network_value_auto);
+
+ }
+ }
return 1;
}
\ No newline at end of file
diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c
index 780750e..24fb3be 100644
--- a/source/ubinstall-gtk-page-switch.c
+++ b/source/ubinstall-gtk-page-switch.c
@@ -117,6 +117,9 @@ int yon_page_save(main_window *widgets, enum YON_PAGES page){
case YON_PAGE_KERNEL:
return yon_kernel_save(widgets);
break;
+ case YON_PAGE_KERNEL_ADDON:
+ return yon_kernel_addon_save(widgets);
+ break;
case YON_PAGE_SOFTWARE:
return yon_software_save(widgets);
break;
diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c
index 89efdb4..f89197d 100644
--- a/source/ubinstall-gtk.c
+++ b/source/ubinstall-gtk.c
@@ -506,7 +506,7 @@ main_window *yon_main_window_complete(){
widgets->NetworkNTPEntry = yon_gtk_builder_get_widget(builder,"NetworkNTPEntry");
widgets->NetworkConnectionsBox = yon_gtk_builder_get_widget(builder,"NetworkConnectionsBox");
widgets->NetworkConnectionsAddButton = yon_gtk_builder_get_widget(builder,"NetworkConnectionsAddButton");
- widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck");
+ widgets->HostnameSensitiveSwitch = yon_gtk_builder_get_widget(builder,"HostnameSensitiveSwitch");
widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck");
widgets->network_connections = NULL;
widgets->pacmanchosen = g_hash_table_new_full(g_str_hash,g_str_equal,free,NULL);
@@ -585,14 +585,29 @@ main_window *yon_main_window_complete(){
yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->NextInstallationFormatRevealer),GTK_SWITCH(widgets->NextInstallationFormatSwitch));
yon_gtk_revealer_set_from_switch(GTK_REVEALER(widgets->SameInstallationFormatRevealer),GTK_SWITCH(widgets->SameInstallationFormatSwitch));
- // g_signal_connect(G_OBJECT(widgets->HostnameSensitiveCheck),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets);
- // g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets);
- // g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets);
g_signal_connect(G_OBJECT(widgets->OSSoftwareCell),"toggled",G_CALLBACK(on_os_components_toggled),widgets);
g_signal_connect(G_OBJECT(widgets->PacmanSoftwareAllCell),"toggled",G_CALLBACK(on_pacman_software_all_toggled),widgets);
g_signal_connect(G_OBJECT(widgets->PacmanSoftwareChosenCell),"toggled",G_CALLBACK(on_pacman_software_chosen_toggled),widgets);
g_signal_connect(G_OBJECT(widgets->PacmanSoftwareSearchEntry),"icon-press",G_CALLBACK(on_pacman_icon_press),widgets);
-
+ g_signal_connect(G_OBJECT(widgets->BootloadUserAddButton),"clicked",G_CALLBACK(on_bootloader_user_add),widgets);
+
+ g_signal_connect(G_OBJECT(widgets->BootloadTimerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->BootloadTimerSpin);
+ g_signal_connect(G_OBJECT(widgets->BootloadNoPasswordSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->BootloadUserRemoveButton);
+ g_signal_connect(G_OBJECT(widgets->BootloadNoPasswordSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->BootloadUserAddButton);
+ g_signal_connect(G_OBJECT(widgets->BootloadNoPasswordSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch_inversed),widgets->BootloadUserTree);
+
+ g_signal_connect(G_OBJECT(widgets->NetworkDomainSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkDomainNameEntry);
+ g_signal_connect(G_OBJECT(widgets->NetworkDomainSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkDomainAdminEntry);
+ g_signal_connect(G_OBJECT(widgets->NetworkDomainSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkDomainPasswordEntry);
+ g_signal_connect(G_OBJECT(widgets->NetworkNTPServerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkNTPCombo);
+ g_signal_connect(G_OBJECT(widgets->NetworkNTPServerSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->NetworkNTPEntry);
+ g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->HotnameEntry);
+ g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"state-set",G_CALLBACK(yon_gtk_widget_set_sensitive_from_switch),widgets->AutoHostnameCheck);
+ g_signal_connect(G_OBJECT(widgets->HostnameSensitiveSwitch),"toggled",G_CALLBACK(on_autohostname_sensitiveness_check),widgets);
+ g_signal_connect(G_OBJECT(widgets->AutoHostnameCheck),"toggled",G_CALLBACK(on_autohostname_check),widgets);
+ g_signal_connect(G_OBJECT(widgets->HotnameEntry),"changed",G_CALLBACK(on_hostname_entry_changed),widgets);
+ g_signal_connect(G_OBJECT(widgets->NetworkConnectionsAddButton),"clicked",G_CALLBACK(on_connection_add),widgets);
+ g_signal_connect(G_OBJECT(widgets->NetworkNTPCombo),"changed",G_CALLBACK(on_ntp_sync),widgets);
{
yon_user_struct *user = yon_user_struct_new();
diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h
index 267bf9c..82f4d52 100755
--- a/source/ubinstall-gtk.h
+++ b/source/ubinstall-gtk.h
@@ -31,6 +31,7 @@
#define glade_path_menu_item "/com/ublinux/ui/ubinstall-gtk-menu-item.glade"
#define glade_path_kernel_row "/com/ublinux/ui/ubinstall-gtk-kernel-row.glade"
#define glade_path_service "/com/ublinux/ui/ubinstall-gtk-service-window.glade"
+#define glade_path_bootloader_user "/com/ublinux/ui/ubinstall-gtk-bootloader-user.glade"
#define CssPath "/com/ublinux/css/ubinstall-gtk.css"
#define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL)
@@ -88,6 +89,9 @@ NULL
#define check_is_password_hash(password) system(yon_char_unite("/lib/ublinux/functions is_hash_password '", password,"'",NULL))
+#define network_value(ip,mask,gateway, dns) g_strdup_printf("ipv4.method manual ipv4.addr %s/%s ipv4.gateway %s ipv4.dns %s",ip,mask,gateway,dns)
+#define network_value_auto "ipv4.method auto"
+
#define get_layouts_command "xkbcli list --load-exotic | awk \"layout && /description:/ {match(\\$0,/: *(.*)/,matches);description=matches[1];printf \\\"%s|%s\\n\\\",layout,description;layout=\\\"\\\"} /layout:/ {match(\\$0, /: *'([^']+)'/,matches);l=matches[1];if (layouts[l]) next;layout=layouts[l]=l}\" | sort -u"
#define get_layouts_local_command(layout) yon_char_unite("xkbcli list --load-exotic | awk -v layout=\"",layout,"\" \"BEGIN {layout_pattern = sprintf(\\\"^ *- *layout: *'%s'\\\",layout);matched=0} matched && /variant:/ {match(\\$0, /: *'([^']+)'/, matches);variant = matches[1]} matched && /description:/ {match(\\$0, /: *(.+)/, matches);description = matches[1]} matched && /^ *-/{matched=0; if (variant) printf \\\"%s|%s\\n\\\",variant,description} \\$0 ~ layout_pattern {matched=1;variant=\\\"\\\";description=\\\"\\\";next}\" | sort -u",NULL)
#define get_devices_command "lsblk --noheadings --nodeps -Jo PATH,SIZE,MODEL,VENDOR,SERIAL --exclude 7,253"
@@ -156,19 +160,37 @@ NULL
#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_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] NTPSERVERS]"
-#define DOMAIN_parameter "AOUTINSTALL[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_command "ubconfig --source global get [autoinstall] AUTOINSTALL[ubconfig set [network] DOMAIN[admanger]]"
+#define NTPSERVERS_parameter "AOUTINSTALL['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_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_command "ubconfig --source global get [autoinstall] AUTOINSTALL['ubconfig set [network] DOMAIN[admanger]']"
#define USERADD_parameter_all "AUTOINSTALL['ubconfig set [users] USERADD[*]']"
#define USERADD_parameter(target) yon_char_unite("AUTOINSTALL['ubconfig set [users] USERADD[",target,"]']",NULL)
#define USERADD_parameter_command(target) yon_char_unite("ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [users] USERADD[",target,"]']",NULL)
#define KERNEL_BOOT_parameter "AUTOINSTALL['ubconfig set [boot] KERNEL_BOOT']"
-#define KERNEL_BOOT_parameter_command "ubconfig --source global get autoinstall AUTOINSTALL[ubconfig set [boot] KERNEL_BOOT]"
-#define SERVICES_ENABLE_parameter "AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE]"
-#define SERVICES_ENABLE_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE]"
+#define KERNEL_BOOT_parameter_command "ubconfig --source global get autoinstall AUTOINSTALL['ubconfig set [boot] KERNEL_BOOT']"
+#define SERVICES_ENABLE_parameter "AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE']"
+#define SERVICES_ENABLE_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] SERVICES_ENABLE']"
+#define GRUB_SUPERUSERS_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']"
+#define GRUB_SUPERUSERS_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']"
+#define GRUB_TIMEOUT_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_TIMEOUT']"
+#define GRUB_TIMEOUT_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_TIMEOUT']"
+#define GRUB_DEFAULT_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_DEFAULT']"
+#define GRUB_DEFAULT_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_DEFAULT']"
+#define GRUB_SUPERUSERS_parameter "AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']"
+#define GRUB_SUPERUSERS_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_SUPERUSERS']"
+#define GRUB_PASSWORD_parameter_search "AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD["
+#define GRUB_PASSWORD_parameter_all "AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD[*]']"
+#define GRUB_PASSWORD_parameter(target) yon_char_unite("AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD[",target,"]']",NULL)
+#define GRUB_PASSWORD_parameter_command_all "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD[*]']"
+#define GRUB_PASSWORD_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] GRUB_PASSWORD[",target,"]']",NULL)
+#define AUTOLOGINUSER_parameter "AUTOINSTALL['ubconfig set [desktop] AUTOLOGINUSER']"
+#define AUTOLOGINUSER_parameter_command "ubconfig get autoinstall AUTOINSTALL['ubconfig set [boot] AUTOLOGINUSER']"
+#define NETWORK_parameter(target) yon_char_unite("AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@connmod]']",NULL)
+#define NETWORK_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[",target,"@connmod]']",NULL)
+#define NETWORK(target) yon_char_unite("NETWORK[",target,"@connmod]",NULL)
#define save_config_command(parameters) yon_char_unite("ubconfig --target system set [autoinstall] AUTOINSTALL[log]=yes ",parameters, "; nice ubinstall2 --debug autoinstall", NULL)
@@ -505,7 +527,7 @@ typedef struct {
GtkWidget *LoginSensitiveCheck;
GtkWidget *UserRootOnlyCheck;
GtkWidget *AutologinSensitiveCheck;
- GtkWidget *HostnameSensitiveCheck;
+ GtkWidget *HostnameSensitiveSwitch;
GtkWidget *KernelListBox;
GtkWidget *KernelInstallLabel;
@@ -763,6 +785,22 @@ struct pacman_struct{
config_str packages;
};
+typedef struct {
+ GtkWidget *Window;
+ GtkWidget *StatusBox;
+ GtkWidget *TitleLabel;
+
+ GtkWidget *AdminCheck;
+ GtkWidget *UsernameEntry;
+ GtkWidget *PasswordEntry;
+ GtkWidget *PasswordButton;
+
+ GtkWidget *CancelButton;
+ GtkWidget *AcceptButton;
+
+ char *prev_name;
+} bootloader_user_window;
+
void config_init();
main_window *yon_main_window_complete();
ubinstall_language_window *yon_ubinstall_language_new();
@@ -862,7 +900,7 @@ int yon_startup_save(main_window *widgets);
network_info *yon_network_info_new();
int yon_install_advanced_save(main_window *widgets);
int yon_network_save(main_window *widgets);
-void on_connection_add(main_window *widgets);
+void on_connection_add(GtkWidget *,main_window *widgets);
void on_ntp_sync(GtkWidget *, main_window *widgets);
int yon_advanced_sections_save(dictionary *dict);
void yon_configuration_mode_check(main_window *widgets);
@@ -910,4 +948,10 @@ void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *wid
int yon_pacman_software_save(main_window *widgets);
void on_pacman_icon_press(GtkEntry *self,GtkEntryIconPosition icon_pos,GdkEvent* event,main_window *widgets);
gboolean yon_pacman_fill(struct pacman_struct *pacman);
-void *yon_pacman_load(struct pacman_struct *pacman);
\ No newline at end of file
+void *yon_pacman_load(struct pacman_struct *pacman);
+int yon_kernel_addon_save(main_window *widgets);
+void yon_password_change(GtkWidget *, bootloader_user_window *window);
+bootloader_user_window *yon_bootloader_user_window_new();
+void on_bootloader_user_add(GtkWidget *, main_window *widgets);
+void on_bootloader_user_accept(GtkWidget *, bootloader_user_window *window);
+void yon_bootloader_interface_update(main_window *widgets);
\ No newline at end of file
diff --git a/source/ubl-strings.h b/source/ubl-strings.h
index 07601ba..24df689 100644
--- a/source/ubl-strings.h
+++ b/source/ubl-strings.h
@@ -200,4 +200,8 @@
#define SERVICE_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove service")," ",target," ",_("from the list"),"?",NULL)
#define SERVICE_ADD_TITLE_LABEL _("Add service")
#define SERVICE_EDIT_TITLE_LABEL _("Edit service")
-#define SERVICE_REMOVE_TITLE_LABEL _("Remove service")
\ No newline at end of file
+#define SERVICE_REMOVE_TITLE_LABEL _("Remove service")
+#define BOOTLOADER_USER_EXIST_LABEL(target) yon_char_unite(_("User")," ", target," ", _("is already exists. Do you really want to save user")," ",target,"?",NULL)
+#define GRUB_PASSWORD(target) yon_char_unite("GRUB_PASSWORD[",target,"]",NULL)
+
+#define WRONG_IP_LABEL _("Ip adress is incorrect")
\ No newline at end of file
diff --git a/ubinstall-gtk-bootloader-user.glade b/ubinstall-gtk-bootloader-user.glade
new file mode 100644
index 0000000..44e507a
--- /dev/null
+++ b/ubinstall-gtk-bootloader-user.glade
@@ -0,0 +1,222 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ubinstall-gtk-network-box.glade b/ubinstall-gtk-network-box.glade
index 0dfad0c..318193b 100644
--- a/ubinstall-gtk-network-box.glade
+++ b/ubinstall-gtk-network-box.glade
@@ -1,5 +1,5 @@
-
+
@@ -8,7 +8,7 @@
False
com.ublinux.libublsettingsui-gtk3.trash-symbolic
-
+
True
False
vertical
@@ -43,6 +43,7 @@
True
False
+ 0
- Wired
- Wireless
@@ -194,6 +195,7 @@
True
True
+ 123.123.123.123
True
@@ -218,6 +220,7 @@
True
True
+ 123.123.123.123
True
@@ -254,6 +257,7 @@
True
True
+ 123.123.123.123
True
@@ -278,6 +282,7 @@
True
True
+ 123.123.123.123
True
diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade
index 057cc55..0d64f40 100644
--- a/ubinstall-gtk.glade
+++ b/ubinstall-gtk.glade
@@ -1,5 +1,5 @@
-
+
@@ -2059,6 +2059,9 @@ and help you install UBLinux on your computer
True
AdditionalSoftwareList
0
+
+
+
@@ -3815,6 +3818,7 @@ and help you install UBLinux on your computer
True
+ False
True
BootloaderTimer
@@ -3953,7 +3957,7 @@ and help you install UBLinux on your computer
True
True
in
- 64
+ 128
256
@@ -4174,6 +4178,7 @@ and help you install UBLinux on your computer
True
+ False
True
10
@@ -4198,6 +4203,7 @@ and help you install UBLinux on your computer
True
+ False
True
10
@@ -4222,6 +4228,7 @@ and help you install UBLinux on your computer
True
+ False
True
10
@@ -4269,7 +4276,9 @@ and help you install UBLinux on your computer
True
+ False
False
+ 0
- Default
- DHCP
@@ -4288,6 +4297,7 @@ and help you install UBLinux on your computer
True
+ False
True
@@ -4309,19 +4319,9 @@ and help you install UBLinux on your computer
False
5
-
+
True
True
- False
- True
-
-
- True
- False
- Host name:
- 0
-
-
False
@@ -4329,6 +4329,19 @@ and help you install UBLinux on your computer
0
+
+
+ True
+ False
+ Host name:
+ 0
+
+
+ False
+ True
+ 1
+
+
True