Merge pull request 'Changed connad for backend' (#9) from YanTheKaller/ubinstall-gtk:master into master

Reviewed-on: #9
pull/15/head
Dmitry Razumov 1 year ago
commit b44e75f6b6

@ -226,6 +226,7 @@ void config_init(){
main_config.install_thread=NULL;
main_config.progress_thread=0;
main_config.install_complete=0;
main_config.save_done=0;
}
int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled);
@ -311,31 +312,38 @@ gboolean on_image_slide(void *data){
return 1;
}
void *on_config_save(void *);
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)){};
main_config.install_thread=(GThread*)0x0;
main_config.config_save_thread=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){
int code = system(start_fast_install_command);
// main_config.install_thread=NULL;
main_config.install_complete=1;
if (!code)
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
g_thread_exit(NULL);
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;
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)){
yon_ubl_status_box_spawn(GTK_CONTAINER(widgets->StatusBox),INSTALLATION_ERROR,5,BACKGROUND_IMAGE_FAIL_TYPE);
};
main_config.install_thread=NULL;
main_config.install_complete=1;
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);
}
main_config.config_save_thread=NULL;
}
return NULL;
}
gboolean yon_installation_progress_update(void *data);
@ -441,13 +449,21 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
break;
case YON_PAGE_COMPLETION:{
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->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->CancelInstallButton))),"com.ublinux.libublsettingsui-gtk3.reset-symbolic",GTK_ICON_SIZE_BUTTON);
pthread_t tid;
pthread_create(&tid,NULL,on_config_save,NULL);
// pthread_t tid;
// pthread_create(&tid,NULL,on_config_save,widgets);
}
break;
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 *){
void *on_setup_system_configuration(void *data);
void *on_setup_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_gecos_parameter,
@ -787,18 +805,28 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
} else {
yon_config_remove_by_key(xkboptions_parameter);
}
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
if (!main_config.install_complete){
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){
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->NextButton,0);
gtk_widget_set_sensitive(widgets->BackButton,0);
}break;
case YON_PAGE_INSTALLATION_BEGIN:{
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);
} break;
case YON_PAGE_COMPLETION:

@ -112,7 +112,7 @@ NULL
#define part_type_parameter "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)
@ -166,6 +166,8 @@ typedef struct {
int always_open_documentation;
int password_min_length;
int save_done;
int install_complete;
int debug_mode;

@ -113,4 +113,6 @@
#define DOCUMENTATION_QUESTION_LABEL _("Would you like to read documentation in the Web?")
#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 OPEN_DOCUMENTATION_LABEL _("Open documentation")
#define OPEN_DOCUMENTATION_LABEL _("Open documentation")
#define INSTALLATION_ERROR _("Installation error")
Loading…
Cancel
Save