test fix for completion page

pull/9/head
parent e539fd3f10
commit be13dd928d

@ -226,6 +226,7 @@ void config_init(){
main_config.install_thread=NULL; main_config.install_thread=NULL;
main_config.progress_thread=0; main_config.progress_thread=0;
main_config.install_complete=0; main_config.install_complete=0;
main_config.save_done=0;
} }
int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled); int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled);
@ -311,8 +312,18 @@ gboolean on_image_slide(void *data){
return 1; return 1;
} }
void *on_config_save(void *); char* yon_debug_output(char *pattern,char*text);
void *on_config_save(void *){ char* yon_debug_output(char *pattern,char*text){
if (main_config.debug_mode){
printf(pattern,text);
}
return text;
}
void *on_config_save(void *data);
void *on_config_save(void *data){
main_window *widgets = (main_window*)data;
if (!main_config.install_complete){
int size=0; int size=0;
config_str parameters = yon_config_get_all(&size); config_str parameters = yon_config_get_all(&size);
main_config.install_thread=(GThread*)0x1; main_config.install_thread=(GThread*)0x1;
@ -320,30 +331,30 @@ void *on_config_save(void *){
if (file) if (file)
fclose(file); fclose(file);
char *command = save_config_command(yon_char_parsed_to_string(parameters,size," ")); char *command = save_config_command(yon_char_parsed_to_string(parameters,size," "));
if (system(command)){}; if (!system(command)){
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),INSTALLATION_ERROR,5,BACKGROUND_IMAGE_FAIL_TYPE);
};
yon_debug_output("%s\n","SUCCESS");
main_config.install_thread=NULL;
main_config.install_complete=1;
if (gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook))){
if (main_config.save_done){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
}
}
main_config.install_thread=(GThread*)0x0; main_config.install_thread=(GThread*)0x0;
main_config.config_save_thread=NULL; main_config.config_save_thread=NULL;
}
return NULL; return NULL;
} }
char* yon_debug_output(char *pattern,char*text);
char* yon_debug_output(char *pattern,char*text){
if (main_config.debug_mode){
printf(pattern,text);
}
return text;
}
void *yon_installation_start(main_window *widgets); void *yon_installation_start(main_window *widgets);
void *yon_installation_start(main_window *widgets){ void *yon_installation_start(main_window *widgets){
if (!main_config.install_complete){ if (!main_config.install_complete){
if (system(start_fast_install_command)){ if (system(start_fast_install_command)){
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),INSTALLATION_ERROR,5,BACKGROUND_IMAGE_FAIL_TYPE);
} }
yon_debug_output("%s\n","SUCCESS");
main_config.install_thread=NULL;
main_config.install_complete=1;
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
} }
g_thread_exit(NULL); g_thread_exit(NULL);
@ -460,7 +471,7 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.libublsettingsui-gtk3.reset-symbolic",GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->CancelInstallButton))),"com.ublinux.libublsettingsui-gtk3.reset-symbolic",GTK_ICON_SIZE_BUTTON);
pthread_t tid; pthread_t tid;
pthread_create(&tid,NULL,on_config_save,NULL); pthread_create(&tid,NULL,on_config_save,widgets);
} }
break; break;
case YON_PAGE_INSTALL_COMMON: case YON_PAGE_INSTALL_COMMON:
@ -471,8 +482,9 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
} }
} }
void *on_setup_system_configuration(void *); void *on_setup_system_configuration(void *data);
void *on_setup_system_configuration(void *){ void *on_setup_system_configuration(void * data){
main_window *widgets = (main_window*)data;
int size; int size;
config_str all_parameters = yon_config_get_selection_by_key(&size, config_str all_parameters = yon_config_get_selection_by_key(&size,
user_gecos_parameter, user_gecos_parameter,
@ -496,6 +508,9 @@ void *on_setup_system_configuration(void *){
free(command); free(command);
if (parameter_string) free(parameter_string); if (parameter_string) free(parameter_string);
} }
main_config.save_done=1;
if (main_config.install_complete)
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
return NULL; return NULL;
} }
@ -807,7 +822,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
} }
if (gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress))>0.9){ if (gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress))>0.9){
pthread_t tid; pthread_t tid;
pthread_create(&tid,NULL,on_setup_system_configuration,NULL); pthread_create(&tid,NULL,on_setup_system_configuration,widgets);
} }
gtk_widget_set_sensitive(widgets->CancelInstallButton,0); gtk_widget_set_sensitive(widgets->CancelInstallButton,0);
gtk_widget_set_sensitive(widgets->NextButton,0); gtk_widget_set_sensitive(widgets->NextButton,0);
@ -815,7 +830,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
}break; }break;
case YON_PAGE_INSTALLATION_BEGIN:{ case YON_PAGE_INSTALLATION_BEGIN:{
pthread_t tid; pthread_t tid;
pthread_create(&tid,NULL,on_config_save,NULL); pthread_create(&tid,NULL,on_config_save,widgets);
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
} break; } break;
case YON_PAGE_COMPLETION: case YON_PAGE_COMPLETION:

@ -167,6 +167,8 @@ typedef struct {
int password_min_length; int password_min_length;
int save_done;
int install_complete; int install_complete;
int debug_mode; int debug_mode;
guint slider_thread; guint slider_thread;

Loading…
Cancel
Save