master #69

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

@ -156,25 +156,6 @@ void yon_load_proceed(YON_CONFIG_TYPE type){
}
void yon_interface_update(main_window *widgets){
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RegionSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LanguagesSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->MainLanguageSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->KeyboardModelSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LayoutSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->UsernameSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->LoginSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->PasswordSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->RootPasswordSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->HostnameSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->CommonFilesystemSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->CommonSectionSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextSizeSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextFSTypeSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->NextLabelSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameFSTypeSensitiveCheck),0);
// gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->SameLabelSensitiveCheck),0);
if (widgets){};
enum YON_PAGES page=YON_PAGE_COMPLETED;
char *type = config(AUTOINSTALL_TYPE_INSTALL);
@ -930,7 +911,7 @@ int yon_image_resize_from_container(GtkImage *target, GdkPixbuf *pixbuf_unscaled
void on_region_resized(GtkWidget *,main_window *widgets);
void on_region_resized(GtkWidget *,main_window *widgets){
yon_image_resize_from_container(GTK_IMAGE(widgets->SlidesImage), widgets->slides_original[cur_slide]);
yon_image_resize_from_container(GTK_IMAGE(widgets->SlidesImage), (GdkPixbuf*)g_list_nth_data(widgets->slides_original,cur_slide));
yon_image_resize_from_container(GTK_IMAGE(widgets->RegionImage), widgets->regions_original);
yon_image_resize_from_container(GTK_IMAGE(widgets->KeyboardImage), widgets->keyboard_original);
}
@ -945,6 +926,7 @@ void on_toggle_block(GtkToggleButton *self){
void yon_switch_page_render(main_window *widgets, int page);
void yon_switch_page_render(main_window *widgets, int page){
if (widgets&&page){};
GtkContainer *parent = GTK_CONTAINER(gtk_widget_get_parent(widgets->UsersToggle));
GList *list = gtk_container_get_children(parent);
for (guint i=0;i<g_list_length(list);i++){
@ -969,8 +951,8 @@ gboolean on_image_slide(void *data){
config_str target = yon_char_parsed_new(&size,slide_repeat_path);
if (size)
yon_char_parsed_free(target,size);
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),widgets->slides_original[cur_slide]);
gtk_widget_queue_draw(widgets->SlidesImage);
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;
return 1;
}
@ -982,6 +964,8 @@ char* yon_debug_output(char *pattern,char*text){
return text;
}
void *on_setup_system_configuration(void *data);
void *on_config_save(void *data);
void *on_config_save(void *data){
main_window *widgets = (main_window*)data;
@ -1013,9 +997,11 @@ void *on_config_save(void *data){
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){
if (!main_config.save_done){
yon_debug_output("%s\n","Entered installation page change");
g_thread_new("success func",(GThreadFunc)on_install_success,widgets);
pthread_t tid;
pthread_create(&tid,NULL,on_setup_system_configuration,widgets);
// g_thread_new("success func",(GThreadFunc)on_install_success,widgets);
}
main_config.config_save_thread=NULL;
@ -1113,12 +1099,10 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
break;
case YON_PAGE_INSTALLATION:{
yon_switch_page_render(widgets,3);
// yon_switch_page_render(widgets,3);
gtk_widget_set_sensitive(widgets->BackButton,0);
if ((!main_config.configure_mode))
gtk_widget_set_sensitive(widgets->CancelInstallButton,0);
if (main_config.config_save_thread&&!main_config.configure_mode)
g_thread_join(main_config.config_save_thread);
if (!main_config.progress_thread&&!main_config.configure_mode)
main_config.progress_thread = gdk_threads_add_timeout(500,(GSourceFunc)yon_installation_progress_update,widgets);
@ -1168,8 +1152,8 @@ void on_page_changed(GtkWidget *,GtkWidget *,int page, main_window *widgets){
textdomain(LocaleName);
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.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON);
gtk_image_set_from_icon_name(GTK_IMAGE(gtk_button_get_image(GTK_BUTTON(widgets->NextButton))),
"com.ublinux.ubinstall-gtk.sync-symbolic",GTK_ICON_SIZE_BUTTON);
yon_debug_output("%s\n","Done labels and button icon");
}
break;
@ -1227,7 +1211,6 @@ void *on_install_error(main_window *widgets){
return NULL;
}
void *on_setup_system_configuration(void *data);
void *on_setup_system_configuration(void * data){
yon_debug_output("%s\n","Entered thread");
main_window *widgets = (main_window*)data;
@ -1676,6 +1659,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
yon_config_remove_by_key(user_gecos_parameter);
} else {
char *username = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->UserNameEntry));
if (username){};
yon_config_register(user_gecos_parameter,user_gecos_parameter_command,username);
}
@ -1683,6 +1667,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
yon_config_remove_by_key(user_name_parameter);
} else {
char *login = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->LoginEntry));
if (login){};
yon_config_register(user_name_parameter,user_name_parameter_command,login);
}
@ -1695,6 +1680,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
return;
} else {
char *password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->PasswordEntry));
if (password){};
yon_config_register(user_password_parameter,user_password_parameter_command,password);
@ -1715,6 +1701,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
return;
} else {
char *root_password = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->AdminPasswordEntry));
if (root_password){};
yon_config_register(root_password_parameter,root_password_parameter_command,root_password);
}
@ -1731,6 +1718,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
} else {
if (!yon_char_is_empty(gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry)))){
char *hostname = (char*)gtk_entry_get_text(GTK_ENTRY(widgets->HotnameEntry));
if (hostname){};
yon_config_register(hostname_parameter,hostname_parameter_command,hostname);
} else {
@ -1744,6 +1732,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinSensitiveCheck))){
char *autologin = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->AutologinCheck))?"yes":"no";
if (autologin){};
yon_config_register(autologin_parameter,autologin_parameter_command,autologin);
} else {
yon_config_remove_by_key(autologin_parameter);
@ -1763,6 +1752,7 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
}
}
if (!yon_char_is_empty(locales)){
printf("%s\n",locales);
yon_config_register(xkblayout_parameter,xkblayout_parameter_command,locales);
} else {
yon_config_remove_by_key(xkblayout_parameter);
@ -1774,34 +1764,29 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
if (gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->LayoutBindingCombo))&&gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->OptionsSensitiveCheck))){
char *options = (char*)gtk_combo_box_get_active_id(GTK_COMBO_BOX(widgets->LayoutBindingCombo));
if (options){};
yon_config_register(xkboptions_parameter,xkboptions_parameter_command,options);
} else {
yon_config_remove_by_key(xkboptions_parameter);
}
if (!main_config.configure_mode){
yon_debug_output("%s\n","Entered saving");
if (!main_config.install_complete){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
}
if (gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress))>0.9){
if (main_config.install_complete){
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);
pthread_t tid;
yon_debug_output("%s\n","installation ending configuration startup");
pthread_create(&tid,NULL,on_setup_system_configuration,widgets);
} else {
pthread_t tid;
pthread_create(&tid,NULL,on_save_system_configuration,widgets);
yon_debug_output("%s\n","installation process configuration startup");
}
main_config.save_done=1;
yon_debug_output("Save changed to: %s\n",yon_char_from_int(main_config.save_done));
pthread_create(&tid,NULL,on_setup_system_configuration,widgets);
yon_debug_output("Install state: %s\n",yon_char_from_int(main_config.install_complete));
gtk_widget_set_sensitive(widgets->CancelInstallButton,0);
gtk_widget_set_sensitive(widgets->NextButton,0);
gtk_widget_set_sensitive(widgets->BackButton,0);
main_config.save_done=1;
}
if (!main_config.install_complete){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
gtk_widget_set_sensitive(widgets->CancelInstallButton,0);
gtk_widget_set_sensitive(widgets->NextButton,0);
gtk_widget_set_sensitive(widgets->BackButton,0);
@ -2548,7 +2533,8 @@ main_window *yon_main_window_complete(){
gtk_window_set_icon_name(GTK_WINDOW(widgets->MainWindow),icon_path);
int size;
config_str parsed = yon_file_open(licence_path,&size);
config_str parsed = NULL;
parsed = yon_file_open(licence_path,&size);
if (size){
char *licence = yon_char_parsed_to_string(parsed,size,"");
gtk_label_set_text(GTK_LABEL(widgets->LicenceLabel),licence);
@ -2559,11 +2545,12 @@ main_window *yon_main_window_complete(){
config_str slides = yon_char_parsed_new(&size,slide_repeat_path);
widgets->regions_original = gdk_pixbuf_new_from_resource(regions_path,NULL);
widgets->keyboard_original = gdk_pixbuf_new_from_resource(keyboard_path,NULL);
widgets->slides_original = malloc(sizeof(GdkPixbuf*)*size);
widgets->slides_original[0] = gdk_pixbuf_new_from_resource(slide_0_path,NULL);
widgets->slides_original = NULL;
widgets->slides_original = g_list_prepend(widgets->slides_original,gdk_pixbuf_new_from_resource(slide_0_path,NULL));
for (int i=1;i<size;i++){
widgets->slides_original[i] = gdk_pixbuf_new_from_resource(slides[i-1],NULL);
widgets->slides_original = g_list_prepend(widgets->slides_original,gdk_pixbuf_new_from_resource(slides[i-1],NULL));
}
widgets->slides_original = g_list_reverse(widgets->slides_original);
yon_char_parsed_free(slides,size);
int width = gdk_pixbuf_get_width(widgets->regions_original);
int height = gdk_pixbuf_get_height(widgets->regions_original);
@ -2574,7 +2561,7 @@ main_window *yon_main_window_complete(){
pix = gdk_pixbuf_scale_simple(widgets->keyboard_original,600,400,GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->KeyboardImage),pix);
g_object_unref(pix);
pix = gdk_pixbuf_scale_simple(widgets->slides_original[0],600,400,GDK_INTERP_BILINEAR);
pix = gdk_pixbuf_scale_simple((GdkPixbuf*)g_list_nth_data(widgets->slides_original,0),600,400,GDK_INTERP_BILINEAR);
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->SlidesImage),pix);
g_object_unref(pix);

@ -357,7 +357,7 @@ typedef struct {
GdkPixbuf *regions_original;
GdkPixbuf *keyboard_original;
GdkPixbuf **slides_original;
GList *slides_original;
float region_height_mult;
GtkWidget *RegionSensitiveCheck;

@ -47,7 +47,7 @@ msgstr "Показать версию пакета"
#: source/ubl-strings.h:2
msgid "Lock this help menu"
msgstr "Заблокировать эту подсазку"
msgstr "Заблокировать эту подсказку"
#: source/ubl-strings.h:2
msgid "Lock configuration saving"

Loading…
Cancel
Save