Changed connad for backend #9

Merged
asmeron merged 15 commits from YanTheKaller/ubinstall-gtk:master into master 1 year ago

@ -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,22 +331,19 @@ 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)){
main_config.install_thread=(GThread*)0x0; yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),INSTALLATION_ERROR,5,BACKGROUND_IMAGE_FAIL_TYPE);
main_config.config_save_thread=NULL; };
return NULL; main_config.install_thread=NULL;
}
void *yon_installation_start(main_window *widgets);
void *yon_installation_start(main_window *widgets){
int code = system(start_fast_install_command);
// main_config.install_thread=NULL;
main_config.install_complete=1; main_config.install_complete=1;
if (!code) yon_debug_output("Install set to: %s\n",yon_char_from_int(main_config.install_complete));
yon_debug_output("Save state: %s\n",yon_char_from_int(main_config.save_done));
if (main_config.save_done){
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); }
main_config.config_save_thread=NULL;
}
return NULL; return NULL;
} }
gboolean yon_installation_progress_update(void *data); gboolean yon_installation_progress_update(void *data);
@ -441,13 +449,21 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
break; break;
case YON_PAGE_COMPLETION:{ case YON_PAGE_COMPLETION:{
gtk_widget_set_sensitive(widgets->BackButton,0); gtk_widget_set_sensitive(widgets->BackButton,0);
gtk_widget_hide(widgets->InstallationProgress);
gtk_widget_hide(widgets->PackageInstallationProgress);
gtk_widget_hide(widgets->InstallationLabel);
gtk_widget_hide(widgets->PackageInstallationLabel);
gtk_widget_set_sensitive(widgets->NextButton,1);
gtk_widget_set_sensitive(widgets->CancelInstallButton,1);
main_config.install_complete=0;
main_config.save_done=0;
gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL); gtk_button_set_label(GTK_BUTTON(widgets->NextButton),RESTART_LABEL);
gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL); gtk_button_set_label(GTK_BUTTON(widgets->CancelInstallButton),EXIT_LABEL);
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);
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:
@ -458,8 +474,10 @@ 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;
if (widgets){};
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,
@ -787,18 +805,28 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
} else { } else {
yon_config_remove_by_key(xkboptions_parameter); yon_config_remove_by_key(xkboptions_parameter);
} }
if (!main_config.install_complete){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION); gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
} else {
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
}
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);
} }
main_config.save_done=1;
yon_debug_output("Save changed to: %s\n",yon_char_from_int(main_config.save_done));
yon_debug_output("Install state: %s\n",yon_char_from_int(main_config.install_complete));
if (main_config.install_complete)
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
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);
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:{
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:

@ -112,7 +112,7 @@ NULL
#define part_type_parameter "AUTOINSTALL[part_fs_type]" #define part_type_parameter "AUTOINSTALL[part_fs_type]"
#define part_type_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_fs_type]" #define part_type_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[part_fs_type]"
#define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target source set [autoinstall] ",parameters, "; nice ubinstall2 autoinstall'", NULL) #define save_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters, "; nice ubinstall2 autoinstall'", NULL)
#define set_user_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,";nice ubinstall2 autoconfig'",NULL) #define set_user_config_command(parameters) yon_char_unite("pkexec bash -c 'ubconfig --target system set [autoinstall] ",parameters,";nice ubinstall2 autoconfig'",NULL)
@ -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;

@ -114,3 +114,5 @@
#define DOCUMENTATION_HEAD_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") #define DOCUMENTATION_HEAD_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.")
#define DOCUMENTATION_CHECK_LABEL _("Always redirect to online documentation") #define DOCUMENTATION_CHECK_LABEL _("Always redirect to online documentation")
#define OPEN_DOCUMENTATION_LABEL _("Open documentation") #define OPEN_DOCUMENTATION_LABEL _("Open documentation")
#define INSTALLATION_ERROR _("Installation error")
Loading…
Cancel
Save