|
|
|
@ -254,9 +254,17 @@ gboolean on_image_slide(void *data){
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void *on_config_save(char *command);
|
|
|
|
void *on_config_save(void *);
|
|
|
|
void *on_config_save(char *command){
|
|
|
|
void *on_config_save(void *){
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
char *command = save_config_command(yon_char_parsed_to_string(parameters,size," "));
|
|
|
|
if (system(command)){};
|
|
|
|
if (system(command)){};
|
|
|
|
|
|
|
|
main_config.install_thread=(GThread*)0x0;
|
|
|
|
main_config.config_save_thread=NULL;
|
|
|
|
main_config.config_save_thread=NULL;
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -264,7 +272,7 @@ void *on_config_save(char *command){
|
|
|
|
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){
|
|
|
|
int code = system(start_fast_install_command);
|
|
|
|
int code = system(start_fast_install_command);
|
|
|
|
main_config.install_thread=NULL;
|
|
|
|
// main_config.install_thread=NULL;
|
|
|
|
main_config.install_complete=1;
|
|
|
|
main_config.install_complete=1;
|
|
|
|
if (!code)
|
|
|
|
if (!code)
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
|
|
|
|
@ -275,21 +283,49 @@ void *yon_installation_start(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
|
|
void *yon_installation_progress_update(void *data);
|
|
|
|
void *yon_installation_progress_update(void *data);
|
|
|
|
void *yon_installation_progress_update(void *data){
|
|
|
|
void *yon_installation_progress_update(void *data){
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
main_window *widgets = (main_window*)data;
|
|
|
|
main_window *widgets = (main_window*)data;
|
|
|
|
FILE *file = fopen(progress_path,"r");
|
|
|
|
FILE *file = NULL;
|
|
|
|
char *current = g_malloc0(4096);
|
|
|
|
char *current = g_malloc0(4096);
|
|
|
|
if (file){
|
|
|
|
clock_t last_time = 0;
|
|
|
|
|
|
|
|
clock_t current_time;
|
|
|
|
while (main_config.install_thread){
|
|
|
|
while (main_config.install_thread){
|
|
|
|
current = fgets(current,4096,file);
|
|
|
|
while (1){
|
|
|
|
if (current[0]!='#'){
|
|
|
|
current_time = clock();
|
|
|
|
|
|
|
|
if ((double)(current_time - last_time) / CLOCKS_PER_SEC >= 0.5){
|
|
|
|
|
|
|
|
if (!file)
|
|
|
|
|
|
|
|
file = fopen(progress_path,"r");
|
|
|
|
|
|
|
|
if (file){
|
|
|
|
|
|
|
|
if (fgets(current,4096,file)){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(current)&¤t[0]=='('){
|
|
|
|
|
|
|
|
char * current_copy = yon_char_new(current);
|
|
|
|
|
|
|
|
char *percentage = yon_char_divide_search(current_copy,")",-1);
|
|
|
|
|
|
|
|
free(yon_char_divide(current_copy,0));
|
|
|
|
|
|
|
|
free(yon_char_divide(percentage,0));
|
|
|
|
|
|
|
|
if (strcmp(percentage,"#pb")){
|
|
|
|
|
|
|
|
double fraction = atof(percentage);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),current_copy);
|
|
|
|
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),fraction/100);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
int size;
|
|
|
|
int size;
|
|
|
|
config_str parsed = yon_char_parse(current,&size,"|");
|
|
|
|
config_str parsed = yon_char_parse(current_copy,&size," ");
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->InstallationLabel),parsed[1]);
|
|
|
|
double fraction = atof(parsed[3])/100;
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),atof(parsed[0]));
|
|
|
|
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->PackageInstallationProgress),fraction/100);
|
|
|
|
}
|
|
|
|
parsed = yon_char_parsed_rip(parsed,&size,3);
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->PackageInstallationLabel),yon_char_parsed_to_string(parsed,size," "));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
last_time = current_time;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
|
|
|
|
file=NULL;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -324,8 +360,8 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
if (main_config.config_save_thread)
|
|
|
|
if (main_config.config_save_thread)
|
|
|
|
g_thread_join(main_config.config_save_thread);
|
|
|
|
g_thread_join(main_config.config_save_thread);
|
|
|
|
if (!main_config.install_thread&&!main_config.install_complete)
|
|
|
|
// if (!main_config.install_thread&&!main_config.install_complete)
|
|
|
|
main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)yon_installation_start,widgets);
|
|
|
|
// main_config.install_thread = g_thread_new("InstallThread",(GThreadFunc)yon_installation_start,widgets);
|
|
|
|
if (!main_config.progress_thread)
|
|
|
|
if (!main_config.progress_thread)
|
|
|
|
main_config.progress_thread = g_thread_new("ProgressThread",(GThreadFunc)yon_installation_progress_update,widgets);
|
|
|
|
main_config.progress_thread = g_thread_new("ProgressThread",(GThreadFunc)yon_installation_progress_update,widgets);
|
|
|
|
|
|
|
|
|
|
|
|
@ -347,9 +383,8 @@ 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->NextButton))),"com.ublinux.libublsettingsui-gtk3.sync-symbolic",GTK_ICON_SIZE_BUTTON);
|
|
|
|
gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),"com.ublinux.libublsettingsui-gtk3.sync-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);
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
int size=0;
|
|
|
|
pthread_t tid;
|
|
|
|
config_str parameters = yon_config_get_all(&size);
|
|
|
|
pthread_create(&tid,NULL,on_config_save,NULL);
|
|
|
|
main_config.config_save_thread = g_thread_new("savethread",(GThreadFunc)on_config_save,save_config_command(yon_char_parsed_to_string(parameters,size," ")));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case YON_PAGE_INSTALL_COMMON:
|
|
|
|
case YON_PAGE_INSTALL_COMMON:
|
|
|
|
@ -481,7 +516,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
char *device;
|
|
|
|
char *device;
|
|
|
|
gtk_tree_model_get(model,&iter,0,&device,-1);
|
|
|
|
gtk_tree_model_get(model,&iter,0,&device,-1);
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"fast");
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"fast");
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type);
|
|
|
|
yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type);
|
|
|
|
|
|
|
|
|
|
|
|
@ -514,8 +549,8 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
char *part;
|
|
|
|
char *part;
|
|
|
|
gtk_tree_model_get(model,&iter,0,&part,-1);
|
|
|
|
gtk_tree_model_get(model,&iter,0,&part,-1);
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"next");
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"next");
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOSTART_PARTS_command,part);
|
|
|
|
yon_config_register(AUTOSTART_PARTS,AUTOSTART_PARTS_command,part);
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type);
|
|
|
|
yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type);
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck)))
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck)))
|
|
|
|
@ -551,8 +586,8 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
char *part;
|
|
|
|
char *part;
|
|
|
|
gtk_tree_model_get(model,&iter,0,&part,-1);
|
|
|
|
gtk_tree_model_get(model,&iter,0,&part,-1);
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"part");
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_TYPE_INSTALL_command,"part");
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
yon_config_register(AUTOINSTALL_DEVICE,AUTOINSTALL_DEVICE_command,device);
|
|
|
|
yon_config_register(AUTOINSTALL_TYPE_INSTALL,AUTOSTART_PARTS_command,part);
|
|
|
|
yon_config_register(AUTOSTART_PARTS,AUTOSTART_PARTS_command,part);
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
yon_config_register(device_label_parameter,device_label_parameter_command,device_name);
|
|
|
|
yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type);
|
|
|
|
yon_config_register(part_type_parameter,part_type_parameter_command,file_system_type);
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck)))
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->NextInstallationFormatCheck)))
|
|
|
|
@ -605,9 +640,8 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
gtk_widget_set_sensitive(widgets->BackButton,0);
|
|
|
|
}break;
|
|
|
|
}break;
|
|
|
|
case YON_PAGE_INSTALLATION_BEGIN:{
|
|
|
|
case YON_PAGE_INSTALLATION_BEGIN:{
|
|
|
|
int size=0;
|
|
|
|
pthread_t tid;
|
|
|
|
config_str parameters = yon_config_get_all(&size);
|
|
|
|
pthread_create(&tid,NULL,on_config_save,NULL);
|
|
|
|
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);
|
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
|
|
|
|
} break;
|
|
|
|
} break;
|
|
|
|
case YON_PAGE_COMPLETION:
|
|
|
|
case YON_PAGE_COMPLETION:
|
|
|
|
|