|
|
|
|
@ -487,25 +487,25 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (fs_type) free(fs_type);
|
|
|
|
|
// if (device_label) free(device_label);
|
|
|
|
|
// if (format) free(format);
|
|
|
|
|
// if (part_size) free(part_size);
|
|
|
|
|
// if (user_name) free(user_name);
|
|
|
|
|
// if (user_gecos) free(user_gecos);
|
|
|
|
|
// if (user_password) free(user_password);
|
|
|
|
|
// if (root_password) free(root_password);
|
|
|
|
|
// if (autologin) free(autologin);
|
|
|
|
|
// if (hostname) free(hostname);
|
|
|
|
|
// if (kbmodel) free(kbmodel);
|
|
|
|
|
// if (optinos) free(optinos);
|
|
|
|
|
// if (layout) free(layout);
|
|
|
|
|
// if (language) free(language);
|
|
|
|
|
// if (zone) free(zone);
|
|
|
|
|
// if (system_locale) free(system_locale);
|
|
|
|
|
// if (region) free(region);
|
|
|
|
|
// if (device) free(device);
|
|
|
|
|
// if (part) free(part);
|
|
|
|
|
if (fs_type) free(fs_type);
|
|
|
|
|
if (device_label) free(device_label);
|
|
|
|
|
if (format) free(format);
|
|
|
|
|
if (part_size) free(part_size);
|
|
|
|
|
if (user_name) free(user_name);
|
|
|
|
|
if (user_gecos) free(user_gecos);
|
|
|
|
|
if (user_password) free(user_password);
|
|
|
|
|
if (root_password) free(root_password);
|
|
|
|
|
if (autologin) free(autologin);
|
|
|
|
|
if (hostname) free(hostname);
|
|
|
|
|
if (kbmodel) free(kbmodel);
|
|
|
|
|
if (optinos) free(optinos);
|
|
|
|
|
if (layout) free(layout);
|
|
|
|
|
if (language) free(language);
|
|
|
|
|
if (zone) free(zone);
|
|
|
|
|
if (system_locale) free(system_locale);
|
|
|
|
|
if (region) free(region);
|
|
|
|
|
if (device) free(device);
|
|
|
|
|
if (part) free(part);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_config_local_load(GtkWidget *,main_window *widgets);
|
|
|
|
|
@ -864,7 +864,6 @@ void config_init(){
|
|
|
|
|
main_config.lock_save_local=0;
|
|
|
|
|
main_config.debug_mode=0;
|
|
|
|
|
main_config.slider_thread=0;
|
|
|
|
|
main_config.config_save_thread=NULL;
|
|
|
|
|
main_config.install_thread=0;
|
|
|
|
|
main_config.progress_thread=0;
|
|
|
|
|
main_config.install_complete=0;
|
|
|
|
|
@ -942,7 +941,14 @@ gboolean on_image_slide(void *data){
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),(GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide));
|
|
|
|
|
// gtk_widget_queue_draw(widgets->SlidesImage);
|
|
|
|
|
if (cur_slide<size-1) cur_slide++; else cur_slide=1;
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
if (!main_config.install_complete){
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
return 1;
|
|
|
|
|
} else{
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* yon_debug_output(char *pattern,char*text){
|
|
|
|
|
@ -960,7 +966,6 @@ void *on_config_save(void *data){
|
|
|
|
|
|
|
|
|
|
int size=0;
|
|
|
|
|
config_str parameters = yon_config_get_all(&size);
|
|
|
|
|
// main_config.install_thread=(GThread*)0x1;
|
|
|
|
|
FILE *file = fopen(progress_path,"w");
|
|
|
|
|
if (file)
|
|
|
|
|
fclose(file);
|
|
|
|
|
@ -970,31 +975,37 @@ void *on_config_save(void *data){
|
|
|
|
|
if (system(yon_debug_output("%s\n",command))){
|
|
|
|
|
yon_debug_output("%s\n","Entered installation failed");
|
|
|
|
|
|
|
|
|
|
g_thread_new("success func",(GThreadFunc)on_install_error,widgets);
|
|
|
|
|
g_thread_new("error func",(GThreadFunc)on_install_error,widgets);
|
|
|
|
|
free(command);
|
|
|
|
|
main_config.config_save_thread=NULL;
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_thread=0;
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_complete=1;
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
yon_debug_output("%s\n","Exit installation");
|
|
|
|
|
pthread_exit(NULL);
|
|
|
|
|
// // pthread_exit(NULL);
|
|
|
|
|
return 0;
|
|
|
|
|
};
|
|
|
|
|
yon_debug_output("%s\n","Entered installation success");
|
|
|
|
|
free(command);
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_thread=0;
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_complete=1;
|
|
|
|
|
yon_debug_output("Install set to: %s\n",yon_char_from_int(main_config.install_complete));
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
yon_debug_output("Save state: %s\n",yon_char_from_int(main_config.save_done));
|
|
|
|
|
if (!main_config.save_done){
|
|
|
|
|
yon_debug_output("%s\n","Entered installation page change");
|
|
|
|
|
pthread_t tid;
|
|
|
|
|
pthread_create(&tid,NULL,on_setup_system_configuration,widgets);
|
|
|
|
|
on_setup_system_configuration(widgets);
|
|
|
|
|
// g_thread_new("success func",(GThreadFunc)on_install_success,widgets);
|
|
|
|
|
}
|
|
|
|
|
main_config.config_save_thread=NULL;
|
|
|
|
|
|
|
|
|
|
yon_debug_output("%s\n","Exit installation");
|
|
|
|
|
pthread_exit(NULL);
|
|
|
|
|
// pthread_exit(NULL);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean yon_installation_progress_update(void *data);
|
|
|
|
|
@ -1002,12 +1013,9 @@ gboolean yon_installation_progress_update(void *data) {
|
|
|
|
|
main_window *widgets = (main_window*)data;
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
|
|
while (main_config.log_progress_buzy) {
|
|
|
|
|
while (gtk_events_pending()) gtk_main_iteration();
|
|
|
|
|
}
|
|
|
|
|
main_config.log_progress_buzy = 1;
|
|
|
|
|
g_mutex_lock(&main_config.progress_mutex);
|
|
|
|
|
config_str text = yon_file_open(progress_path, &size);
|
|
|
|
|
main_config.log_progress_buzy = 0;
|
|
|
|
|
g_mutex_unlock(&main_config.progress_mutex);
|
|
|
|
|
|
|
|
|
|
if (size) {
|
|
|
|
|
if (!yon_char_is_empty(text[size-1]) && text[size-1][0] == '(') {
|
|
|
|
|
@ -1038,9 +1046,12 @@ gboolean yon_installation_progress_update(void *data) {
|
|
|
|
|
yon_char_parsed_free(text, size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
if (main_config.install_thread) {
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel), "");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
@ -1048,6 +1059,7 @@ gboolean yon_installation_progress_update(void *data) {
|
|
|
|
|
|
|
|
|
|
void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets);
|
|
|
|
|
void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
|
if (widgets){};
|
|
|
|
|
switch(page){
|
|
|
|
|
case YON_PAGE_WELCOME: {
|
|
|
|
|
gtk_widget_hide(widgets->SaveButton);
|
|
|
|
|
@ -1115,7 +1127,9 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
|
gtk_widget_hide(widgets->PackageInstallationLabel);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->NextButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->CancelInstallButton,1);
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_complete=0;
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
main_config.save_done=0;
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL);
|
|
|
|
|
@ -1134,7 +1148,9 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->NextButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->CancelInstallButton,1);
|
|
|
|
|
yon_debug_output("%s\n","Done widgets");
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_complete=0;
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
main_config.save_done=0;
|
|
|
|
|
yon_debug_output("%s\n","Done variables");
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
@ -1154,7 +1170,9 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
|
gtk_widget_hide(widgets->PackageInstallationLabel);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->NextButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->CancelInstallButton,1);
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
main_config.install_complete=0;
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
main_config.save_done=0;
|
|
|
|
|
textdomain(LocaleName);
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL);
|
|
|
|
|
@ -1243,37 +1261,6 @@ void on_log_closed(GtkWidget *, dictionary *dict){
|
|
|
|
|
window->Window=NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void *on_save_system_configuration(void *data);
|
|
|
|
|
void *on_save_system_configuration(void * data){
|
|
|
|
|
main_window *widgets = (main_window*)data;
|
|
|
|
|
if (widgets){};
|
|
|
|
|
int size;
|
|
|
|
|
config_str all_parameters = yon_config_get_selection_by_key(&size,
|
|
|
|
|
user_name_parameter,
|
|
|
|
|
user_gecos_parameter,
|
|
|
|
|
user_password_parameter,
|
|
|
|
|
root_password_parameter,
|
|
|
|
|
autologin_parameter,
|
|
|
|
|
xkbmodel_parameter,
|
|
|
|
|
xkblayout_parameter,
|
|
|
|
|
xkbvariant_parameter,
|
|
|
|
|
xkboptions_parameter,
|
|
|
|
|
hostname_parameter,
|
|
|
|
|
zone_parameter,
|
|
|
|
|
lang_parameter,
|
|
|
|
|
locale_parameter,
|
|
|
|
|
NULL);
|
|
|
|
|
if (all_parameters){
|
|
|
|
|
char *parameter_string = yon_char_parsed_to_string(all_parameters,size," ");
|
|
|
|
|
char *command = save_additional_config_command(parameter_string);
|
|
|
|
|
if (system(yon_debug_output("%s\n",command))){};
|
|
|
|
|
yon_char_parsed_free(all_parameters,size);
|
|
|
|
|
free(command);
|
|
|
|
|
if (parameter_string) free(parameter_string);
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log_window *yon_log_window_new();
|
|
|
|
|
log_window *yon_log_window_new(){
|
|
|
|
|
log_window *window = malloc(sizeof(log_window));
|
|
|
|
|
@ -1293,10 +1280,9 @@ gboolean yon_read_log(void *data){
|
|
|
|
|
log_window *window = (log_window*)data;
|
|
|
|
|
if (window->Window){
|
|
|
|
|
int size;
|
|
|
|
|
while (!main_config.install_complete&&main_config.log_progress_buzy){};
|
|
|
|
|
main_config.log_progress_buzy=1;
|
|
|
|
|
g_mutex_lock(&main_config.progress_mutex);
|
|
|
|
|
config_str parsed = yon_file_open(window->command,&size);
|
|
|
|
|
main_config.log_progress_buzy=0;
|
|
|
|
|
g_mutex_unlock(&main_config.progress_mutex);
|
|
|
|
|
if (size){
|
|
|
|
|
char *final = yon_char_parsed_to_string(parsed,size,"");
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(window->LogLabel),final);
|
|
|
|
|
@ -1306,10 +1292,12 @@ gboolean yon_read_log(void *data){
|
|
|
|
|
free(final);
|
|
|
|
|
yon_char_parsed_free(parsed,size);
|
|
|
|
|
}
|
|
|
|
|
yon_debug_output("%s\n","Log read");
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
if (!main_config.install_complete){
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
return 1;
|
|
|
|
|
} else {
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->ScrollToEndCheck),0);
|
|
|
|
|
gtk_widget_set_sensitive(window->ScrollToEndCheck,0);
|
|
|
|
|
}
|
|
|
|
|
@ -1396,8 +1384,8 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
active_id=2;
|
|
|
|
|
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationWindowsRadio)))
|
|
|
|
|
active_id=3;
|
|
|
|
|
// else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio)))
|
|
|
|
|
// active_id=4;
|
|
|
|
|
else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->InstallationRadio)))
|
|
|
|
|
active_id=4;
|
|
|
|
|
main_config.install_mode=active_id;
|
|
|
|
|
switch (active_id){
|
|
|
|
|
case 0:{ // normal installation
|
|
|
|
|
@ -1759,7 +1747,9 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!main_config.configure_mode){
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
if (main_config.install_complete){
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
yon_debug_output("%s\n","Entered saving before installation done");
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),CONFIGURATION_LABEL);
|
|
|
|
|
@ -1772,7 +1762,8 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
|
main_config.save_done=1;
|
|
|
|
|
}
|
|
|
|
|
if (!main_config.install_complete){
|
|
|
|
|
else if (!main_config.install_complete){
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_sensitive(widgets->CancelInstallButton,0);
|
|
|
|
|
@ -1785,6 +1776,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}break;
|
|
|
|
|
|
|
|
|
|
case YON_PAGE_INSTALLATION_BEGIN:{
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
if (!main_config.install_thread){
|
|
|
|
|
pthread_attr_t attr;
|
|
|
|
|
pthread_attr_init(&attr);
|
|
|
|
|
@ -1792,6 +1784,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
|
|
|
|
|
|
pthread_create(&tid,&attr,on_config_save,widgets);
|
|
|
|
|
memcpy(&main_config.install_thread,&tid,sizeof(pthread_t));
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
}
|
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
|
|
|
|
|
} break;
|
|
|
|
|
@ -2231,8 +2224,10 @@ void on_exit_accepted(GtkWidget *,dictionary *dict);
|
|
|
|
|
void on_exit_accepted(GtkWidget *,dictionary *dict){
|
|
|
|
|
main_window *widgets = yon_dictionary_get_data(dict->first,main_window*);
|
|
|
|
|
confirmation_window *window = yon_dictionary_get_data(dict->first->next,confirmation_window*);
|
|
|
|
|
g_mutex_lock(&main_config.install_mutex);
|
|
|
|
|
if (main_config.install_thread){
|
|
|
|
|
pthread_cancel((pthread_t)main_config.install_thread);
|
|
|
|
|
g_mutex_unlock(&main_config.install_mutex);
|
|
|
|
|
}
|
|
|
|
|
main_config.exit_accepted=1;
|
|
|
|
|
g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"delete-event",widgets->MainWindow,NULL);
|
|
|
|
|
@ -2441,7 +2436,7 @@ main_window *yon_main_window_complete(){
|
|
|
|
|
widgets->SameFSTypeSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameFSTypeSensitiveCheck");
|
|
|
|
|
widgets->SameLabelSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameLabelSensitiveCheck");
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets);
|
|
|
|
|
// g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets);
|
|
|
|
|
GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2");
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemmiddle");
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemtop");
|
|
|
|
|
@ -2740,10 +2735,10 @@ int main(int argc, char *argv[]){
|
|
|
|
|
gtk_init(&argc,&argv);
|
|
|
|
|
main_window *widgets = NULL;
|
|
|
|
|
widgets = yon_main_window_complete();
|
|
|
|
|
yon_window_config_setup(GTK_WINDOW(widgets->MainWindow));
|
|
|
|
|
char *window_config_path = config_path;
|
|
|
|
|
yon_window_config_load(window_config_path);
|
|
|
|
|
free(window_config_path);
|
|
|
|
|
// yon_window_config_setup(GTK_WINDOW(widgets->MainWindow));
|
|
|
|
|
// char *window_config_path = config_path;
|
|
|
|
|
// yon_window_config_load(window_config_path);
|
|
|
|
|
// free(window_config_path);
|
|
|
|
|
GtkCssProvider *css=gtk_css_provider_new();
|
|
|
|
|
gtk_css_provider_load_from_resource(css,CssPath);
|
|
|
|
|
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
|
|
|
|
|
|