|
|
|
|
@ -36,9 +36,21 @@ double yon_size_long_convert_automatic(unsigned long bytes, char *size){
|
|
|
|
|
|
|
|
|
|
// standard functions
|
|
|
|
|
|
|
|
|
|
void on_keyboard_accept();
|
|
|
|
|
void on_keyboard_accept(){
|
|
|
|
|
void on_keyboard_accept(GtkWidget *self,main_window *widgets);
|
|
|
|
|
void on_keyboard_accept(GtkWidget *self,main_window *widgets){
|
|
|
|
|
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter));
|
|
|
|
|
on_subwindow_close(self);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_layout_toggle(GtkCellRendererToggle*, gchar* path, ubinstall_keyboard_window *window);
|
|
|
|
|
void on_layout_toggle(GtkCellRendererToggle*, gchar* path, ubinstall_keyboard_window *window){
|
|
|
|
|
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(window->LayoutsTree));
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
if (gtk_tree_model_get_iter_from_string(model,&iter,path)){
|
|
|
|
|
int status=0;
|
|
|
|
|
gtk_tree_model_get(model,&iter,3,&status,-1);
|
|
|
|
|
gtk_tree_store_set(GTK_TREE_STORE(model),&iter,3,!status,-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ubinstall_keyboard_window *yon_ubinstall_keyboard_new(){
|
|
|
|
|
@ -50,9 +62,9 @@ ubinstall_keyboard_window *yon_ubinstall_keyboard_new(){
|
|
|
|
|
window->CancelButton=yon_gtk_builder_get_widget(builder,"CancelButton");
|
|
|
|
|
window->SaveButton=yon_gtk_builder_get_widget(builder,"SaveButton");
|
|
|
|
|
window->LayoutsTree=yon_gtk_builder_get_widget(builder,"LayoutsTree");
|
|
|
|
|
window->ActiveToggle = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ActiveToggle"));
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
|
|
|
|
|
// g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(),NULL);
|
|
|
|
|
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
@ -61,12 +73,10 @@ void on_keyboard_clicked (GtkWidget *, main_window *widgets);
|
|
|
|
|
void on_keyboard_clicked (GtkWidget *, main_window *widgets){
|
|
|
|
|
ubinstall_keyboard_window *window = yon_ubinstall_keyboard_new();
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(window->MainWindow),GTK_WINDOW(widgets->MainWindow),KEYBOARD_TITLE_LABEL,icon_path,"keyboard-window");
|
|
|
|
|
dictionary *dict = NULL;
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(dict,"window",window);
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(window->LayoutsTree),GTK_TREE_MODEL(widgets->LayoutList));
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),dict);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->ActiveToggle),"toggled",G_CALLBACK(on_layout_toggle),window);
|
|
|
|
|
g_signal_connect(G_OBJECT(window->SaveButton),"clicked",G_CALLBACK(on_keyboard_accept),widgets);
|
|
|
|
|
gtk_widget_show(window->MainWindow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -261,6 +271,7 @@ void *yon_installation_start(){
|
|
|
|
|
|
|
|
|
|
void *yon_installation_progress_update(void *data);
|
|
|
|
|
void *yon_installation_progress_update(void *data){
|
|
|
|
|
sleep(1);
|
|
|
|
|
main_window *widgets = (main_window*)data;
|
|
|
|
|
FILE *file = fopen(progress_path,"r");
|
|
|
|
|
char *current = g_malloc0(4096);
|
|
|
|
|
@ -304,7 +315,7 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
|
g_thread_join(main_config.config_save_thread);
|
|
|
|
|
if (!main_config.install_thread)
|
|
|
|
|
main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)on_config_save,NULL);
|
|
|
|
|
main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)yon_installation_start,NULL);
|
|
|
|
|
if (!main_config.install_thread)
|
|
|
|
|
main_config.progress_thread = g_thread_new("ProgressThread",(GThreadFunc)yon_installation_progress_update,widgets);
|
|
|
|
|
|
|
|
|
|
@ -380,6 +391,21 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->LanguagesCombo);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char *region = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->RegionCombo));
|
|
|
|
|
char *zone = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->ZoneCombo));
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->LanguagesFilter);
|
|
|
|
|
char *languages = "";
|
|
|
|
|
char *lang_code=NULL;
|
|
|
|
|
for_iter(model,&iter){
|
|
|
|
|
gtk_tree_model_get(model,&iter,1,&lang_code,-1);
|
|
|
|
|
yon_char_unite(languages,",",lang_code,NULL);
|
|
|
|
|
}
|
|
|
|
|
char *language = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LanguagesCombo));
|
|
|
|
|
yon_config_register(locale_parameter,locale_parameter_command,languages);
|
|
|
|
|
yon_config_register(lang_parameter,lang_parameter_command,language);
|
|
|
|
|
yon_config_register(zone_parameter,zone_parameter_command,yon_char_unite(region,"/",zone,NULL));
|
|
|
|
|
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1);
|
|
|
|
|
}break;
|
|
|
|
|
case YON_PAGE_KEYBOARD: { //keyboard
|
|
|
|
|
@ -392,6 +418,23 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
yon_ubl_status_highlight_incorrect(gtk_widget_get_parent(widgets->LayoutTree));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char *layouts_list="";
|
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->DefaultLayoutRadio))){
|
|
|
|
|
GtkTreeModel *layouts_model=NULL;
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
char *cur_layout=NULL;
|
|
|
|
|
for_iter(layouts_model,&iter){
|
|
|
|
|
gtk_tree_model_get(layouts_model,&iter,0,&cur_layout,-1);
|
|
|
|
|
layouts_list = yon_char_unite(layouts_list,",",cur_layout,NULL);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
yon_config_remove_by_key(xkblayout_parameter);
|
|
|
|
|
}
|
|
|
|
|
char *model = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->KeyboardModelCombo))?(char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->KeyboardModelCombo)):"";
|
|
|
|
|
// char *layout_switch;
|
|
|
|
|
yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,model);
|
|
|
|
|
yon_config_register(locale_parameter,locale_parameter_command,layouts_list);
|
|
|
|
|
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page+1);
|
|
|
|
|
} break;
|
|
|
|
|
default:{ // all other pages
|
|
|
|
|
@ -470,7 +513,47 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
config_str parameters = yon_config_get_all(&size);
|
|
|
|
|
main_config.config_save_thread = g_thread_new("savethread",(GThreadFunc)on_config_save,save_config_command(yon_char_parsed_to_string(parameters,size," ")));
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
|
|
|
|
|
}
|
|
|
|
|
}break;
|
|
|
|
|
case YON_PAGE_USERS:{
|
|
|
|
|
if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry)))){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->UserNameEntry);
|
|
|
|
|
return;
|
|
|
|
|
} else if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry)))){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->UserNameEntry);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
} else if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->PasswordCombo))==1&&yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry)))){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->UserNameEntry);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
} else if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->AdminPasswordCombo))==1&&yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry)))){
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->UserNameEntry);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
} else if (yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)))){
|
|
|
|
|
|
|
|
|
|
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE);
|
|
|
|
|
yon_ubl_status_highlight_incorrect(widgets->UserNameEntry);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
char *username = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
|
|
|
|
|
char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
|
|
|
|
|
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
|
|
|
|
|
char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
|
|
|
|
|
char *hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
|
|
|
|
|
char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck))?"yes":"no";
|
|
|
|
|
yon_config_register(user_name_parameter,user_name_parameter_command,login);
|
|
|
|
|
yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username);
|
|
|
|
|
yon_config_register(user_password_parameter,user_password_parameter_command,password);
|
|
|
|
|
yon_config_register(root_password_parameter,root_password_parameter_command,root_password);
|
|
|
|
|
yon_config_register(autologin_parameter,autologin_parameter_command,autologin);
|
|
|
|
|
yon_config_register(xkbmodel_parameter,xkbmodel_parameter_command,hostname);
|
|
|
|
|
yon_config_register(hostname_parameter,hostname_parameter_command,root_password);
|
|
|
|
|
}break;
|
|
|
|
|
}
|
|
|
|
|
} break;
|
|
|
|
|
case -1: { // Previous
|
|
|
|
|
@ -502,15 +585,16 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_region_changed(GtkComboBox *self, main_window *widgets);
|
|
|
|
|
void on_region_changed(GtkComboBox *self, main_window *widgets){
|
|
|
|
|
char *active = (char*)gtk_combo_box_get_active_id(self);
|
|
|
|
|
void on_region_changed(GtkComboBoxText *self, main_window *widgets);
|
|
|
|
|
void on_region_changed(GtkComboBoxText *self, main_window *widgets){
|
|
|
|
|
char *active = (char*)gtk_combo_box_text_get_active_text(self);
|
|
|
|
|
active = yon_char_append("/usr/share/zoneinfo/",active);
|
|
|
|
|
int size;
|
|
|
|
|
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo));
|
|
|
|
|
if (yon_file_is_directory(active)){
|
|
|
|
|
config_str parsed = yon_file_ls(active,&size);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),_(parsed[i]));
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->ZoneCombo),parsed[i],_(parsed[i]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -692,6 +776,7 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
|
|
|
|
|
widgets->LanguagesList = GTK_LIST_STORE(gtk_builder_get_object(builder,"LanguagesList"));
|
|
|
|
|
widgets->LanguagesFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LanguagesFilter"));
|
|
|
|
|
widgets->LayoutsFilter = GTK_TREE_MODEL(gtk_builder_get_object(builder,"LayoutsFilter"));
|
|
|
|
|
widgets->LayoutList = GTK_TREE_STORE(gtk_builder_get_object(builder,"LayoutList"));
|
|
|
|
|
widgets->AdditionalSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AdditionalSoftwareList"));
|
|
|
|
|
widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList"));
|
|
|
|
|
@ -713,9 +798,12 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SectionsToggle),"toggled",G_CALLBACK(on_toggle_block),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->InstallationToggle),"toggled",G_CALLBACK(on_toggle_block),NULL);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets);
|
|
|
|
|
gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->LanguageCombo),"changed",G_CALLBACK(on_locale_changed),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->AdditionalSoftwareCell),"toggled",G_CALLBACK(on_additional_software_toggled),widgets);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ManualLayoutRadio),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(gtk_widget_get_parent(widgets->AddButton)));
|
|
|
|
|
// g_signal_connect(G_OBJECT(widgets->InstallationToggle),"toggled",G_CALLBACK(on_toggle_block),widgets);
|
|
|
|
|
|
|
|
|
|
gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0);
|
|
|
|
|
@ -763,7 +851,7 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
if (!strstr(parsed[i],".")&&strcmp(parsed[i],"posix")&&strcmp(parsed[i],"right")){
|
|
|
|
|
char *path = yon_char_append(zone_path,parsed[i]);
|
|
|
|
|
if (yon_file_is_directory(path)){
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->RegionCombo),path,_(parsed[i]));
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->RegionCombo),parsed[i],_(parsed[i]));
|
|
|
|
|
}
|
|
|
|
|
free(path);
|
|
|
|
|
}
|
|
|
|
|
@ -778,7 +866,7 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
if (layout_size){
|
|
|
|
|
char *layout_id = yon_char_new(layout[0]);
|
|
|
|
|
gtk_tree_store_append(widgets->LayoutList,&iter,NULL);
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,0,-1);
|
|
|
|
|
gtk_tree_store_set(widgets->LayoutList,&iter,0,layout[0],1,_(layout[1]),2,1,-1);
|
|
|
|
|
yon_char_parsed_free(layout,layout_size);
|
|
|
|
|
layout = yon_config_load(get_layouts_local_command(layout_id),&layout_size);
|
|
|
|
|
for (int j=0;j<layout_size;j++){
|
|
|
|
|
@ -830,6 +918,14 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
gtk_list_store_set(widgets->AdditionalSoftwareList,&iter,0,1,1,module_parsed[0],3,module_parsed[1],-1); //2,module_parsed[2]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
config_str models = yon_config_load(get_models_command,&size);
|
|
|
|
|
for (int i=0;i<size;i+=2){
|
|
|
|
|
models[i] = yon_char_divide_search(models[i],"\n",-1);
|
|
|
|
|
models[i+1] = yon_char_divide_search(models[i+1],"\n",-1);
|
|
|
|
|
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widgets->KeyboardModelCombo),models[i],_(models[i+1]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return widgets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|