diff --git a/source/ubinstall-gtk-configuration-mode.c b/source/ubinstall-gtk-configuration-mode.c index b40197e..b7e72f4 100644 --- a/source/ubinstall-gtk-configuration-mode.c +++ b/source/ubinstall-gtk-configuration-mode.c @@ -1,18 +1,11 @@ #include "ubinstall-gtk.h" -void configuration_mode_accept(GtkWidget *,configuration_window *window){ - const char *path = gtk_entry_get_text(GTK_ENTRY(window->PathEntry)); - if (yon_char_is_empty(path)){ - yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); - yon_ubl_status_highlight_incorrect(window->PathEntry); - return; - } - +int yon_configuration_path_check(const char *path){ + char *full_path = yon_char_new(path); if (access(path,F_OK)){ int homedir_create = 0; - int file_create = 0; int pos = yon_char_find_last((char*)path,'/'); - if (pos>=-1){ + if (pos>-1){ char *path_copy = yon_char_new(path); char *dir_path = yon_char_divide(path_copy,pos); if (access(dir_path,F_OK)){ @@ -20,25 +13,39 @@ void configuration_mode_accept(GtkWidget *,configuration_window *window){ } free(path_copy); free(dir_path); + } else { + homedir_create = 1; + } dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); data->action_text = homedir_create?CREATE_CONFIG_DIALOG_LABEL_HOMEDIR:CREATE_CONFIG_DIALOG_LABEL; data->title = WARNING_TITLE_LABEL; - if (yon_confirmation_dialog_call(window->Window,data)==GTK_RESPONSE_ACCEPT){ - char *full_path = NULL; + if (yon_confirmation_dialog_call(NULL,data)==GTK_RESPONSE_ACCEPT){ if (homedir_create){ + free(full_path); full_path = yon_char_unite(yon_ubl_user_get_home_directory(),"/",path,NULL); - } else if (file_create){ - } else { + free(full_path); full_path = yon_char_new(path); } + yon_launch(ubconfig_file_create(full_path)); - yon_launch(ubconfig_file_create(full_path)); - } else return; + } else return 0; } if (!yon_char_is_empty(main_config.config_save_path)) free(main_config.config_save_path); - main_config.config_save_path = yon_char_new(path); + main_config.config_save_path = yon_char_new(full_path); + return 1; +} + +void configuration_mode_accept(GtkWidget *,configuration_window *window){ + const char *path = gtk_entry_get_text(GTK_ENTRY(window->PathEntry)); + if (yon_char_is_empty(path)){ + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),_EMPTY_IMPORTANT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + yon_ubl_status_highlight_incorrect(window->PathEntry); + return; + } + yon_configuration_path_check(path); + gtk_widget_destroy(window->Window); } diff --git a/source/ubinstall-gtk-install-start.c b/source/ubinstall-gtk-install-start.c index 67d6f6f..9201743 100644 --- a/source/ubinstall-gtk-install-start.c +++ b/source/ubinstall-gtk-install-start.c @@ -2,7 +2,8 @@ int yon_installation_start(main_window *widgets){ gtk_widget_show(gtk_widget_get_parent(widgets->InstallationProgress)); - return !pthread_create(&main_config.install_thread,NULL,on_config_save,widgets); + int ret = !pthread_create(&main_config.install_thread,NULL,on_config_save,widgets); + return ret; } void yon_quick_install(GtkWidget *self, main_window *widgets){ diff --git a/source/ubinstall-gtk-log.c b/source/ubinstall-gtk-log.c index 65f82d7..9ce537f 100644 --- a/source/ubinstall-gtk-log.c +++ b/source/ubinstall-gtk-log.c @@ -88,7 +88,11 @@ void yon_installation_progress_update(GFileMonitor *,GFile *,GFile *,GFileMonito g_mutex_lock(&main_config.progress_mutex); config_str text = yon_file_open(progress_path, &size); - if (!text||!size) return; + if (!text||!size){ + g_mutex_unlock(&main_config.progress_mutex); + return; + } + g_mutex_unlock(&main_config.progress_mutex); if (size) { diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index b5dcec1..0eedf03 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -8,10 +8,10 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_WELCOME: return YON_PAGE_LICENCE; break; case YON_PAGE_LICENCE: return YON_PAGE_SECTIONS; break; case YON_PAGE_SECTIONS: return yon_sections_get_next_page(widgets); break; - case YON_PAGE_OS_COMPONENTS: return YON_PAGE_INSTALLATION_BEGIN; break; + case YON_PAGE_OS_COMPONENTS: return main_config.configure_mode?YON_PAGE_CONFIG_HUB:YON_PAGE_INSTALLATION_BEGIN; break; case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_CONFIG_HUB; break; case YON_PAGE_SOFTWARE: return YON_PAGE_CONFIG_HUB; break; - case YON_PAGE_CONFIG_HUB: return YON_PAGE_INSTALLATION; break; + case YON_PAGE_CONFIG_HUB: return main_config.configure_mode? YON_PAGE_CONFIGURE_END:YON_PAGE_INSTALLATION; break; case YON_PAGE_KERNEL: return YON_PAGE_CONFIG_HUB; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_CONFIG_HUB; break; case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_CONFIG_HUB; break; @@ -29,10 +29,10 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_INSTALL_SAME_PARTITION: return YON_PAGE_OS_COMPONENTS; break; case YON_PAGE_INSTALL_ADVANCED: return YON_PAGE_OS_COMPONENTS; break; case YON_PAGE_INSTALL_RECOVERY: return yon_recovery_get_next(widgets); break; - case YON_PAGE_RECOVERY_GRUB_INSTALL: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_RECOVERY_BEGIN; break; - case YON_PAGE_RECOVERY_GRUB_UPDATE: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_RECOVERY_BEGIN; break; - case YON_PAGE_RECOVERY_OS_ONLY: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_RECOVERY_BEGIN; break; - case YON_PAGE_RECOVERY_USRDATA_ONLY: return main_config.configure_mode?YON_PAGE_INSTALLATION:YON_PAGE_RECOVERY_BEGIN; break; + case YON_PAGE_RECOVERY_GRUB_INSTALL: return main_config.configure_mode?YON_PAGE_CONFIGURE_END:YON_PAGE_RECOVERY_BEGIN; break; + case YON_PAGE_RECOVERY_GRUB_UPDATE: return main_config.configure_mode?YON_PAGE_CONFIGURE_END:YON_PAGE_RECOVERY_BEGIN; break; + case YON_PAGE_RECOVERY_OS_ONLY: return main_config.configure_mode?YON_PAGE_CONFIGURE_END:YON_PAGE_RECOVERY_BEGIN; break; + case YON_PAGE_RECOVERY_USRDATA_ONLY: return main_config.configure_mode?YON_PAGE_CONFIGURE_END:YON_PAGE_RECOVERY_BEGIN; break; case YON_PAGE_RECOVERY_BEGIN: main_config.save_configured = 1; return YON_PAGE_RECOVERY_PROCESS; break; case YON_PAGE_RECOVERY_PROCESS: return YON_PAGE_RECOVERY_COMPLETION; break; case YON_PAGE_INSTALLATION: return YON_PAGE_COMPLETION; break; @@ -459,12 +459,18 @@ void yon_page_init(main_window *widgets, enum YON_PAGES page){ void on_page_next_clicked(GtkWidget *, main_window *widgets){ enum YON_PAGES page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + printf("2\n"); page = yon_page_get_next(widgets,page); + printf("3\n"); if ((int)page!=-1){ gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),page); + printf("4\n"); yon_page_init(widgets,page); + printf("5\n"); } + printf("6\n"); yon_page_update(widgets); + printf("7\n"); } void on_page_prev_clicked(GtkWidget *, main_window *widgets){ @@ -476,40 +482,49 @@ void on_page_prev_clicked(GtkWidget *, main_window *widgets){ yon_page_update(widgets); } -void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ +#include - if (main_config.install_thread){ - dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); - data->action_text=INTERRUPT_TEXT_LABEL; - data->title=WARNING_TITLE_LABEL; - if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ - pthread_cancel((pthread_t)main_config.install_thread); - gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); - GtkWidget *image = gtk_button_get_image(GTK_BUTTON(widgets->NextButton)); - gtk_image_set_from_icon_name(GTK_IMAGE(image),arrow_right_icon_path,GTK_ICON_SIZE_BUTTON); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LicenseAgreeRadio))){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); +void on_page_cancel_clicked(GtkWidget *, main_window *widgets){ + enum YON_PAGES cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->Notebook)); + switch (cur_page){ + case YON_PAGE_CONFIGURE_END: + gtk_main_quit(); + break; + default: { + if (main_config.install_thread){ + dialog_confirmation_data *data = yon_confirmation_dialog_data_new(); + data->action_text=INTERRUPT_TEXT_LABEL; + data->title=WARNING_TITLE_LABEL; + if (yon_confirmation_dialog_call(widgets->MainWindow,data)==GTK_RESPONSE_ACCEPT ){ + kill(main_config.install_thread,SIGKILL); + gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); + GtkWidget *image = gtk_button_get_image(GTK_BUTTON(widgets->NextButton)); + gtk_image_set_from_icon_name(GTK_IMAGE(image),arrow_right_icon_path,GTK_ICON_SIZE_BUTTON); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LicenseAgreeRadio))){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); + } else { + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); + } + yon_page_update(widgets); + main_config.save_done=0; + main_config.install_complete=0; + main_config.install_thread=0; + } } else { - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); + gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); + GtkWidget *image = gtk_button_get_image(GTK_BUTTON(widgets->NextButton)); + gtk_image_set_from_icon_name(GTK_IMAGE(image),arrow_right_icon_path,GTK_ICON_SIZE_BUTTON); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LicenseAgreeRadio))){ + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); + } else { + gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); + } + yon_page_update(widgets); + main_config.save_done=0; + main_config.install_complete=0; + main_config.install_thread=0; } - yon_page_update(widgets); - main_config.save_done=0; - main_config.install_complete=0; - main_config.install_thread=0; - } - } else { - gtk_button_set_label(GTK_BUTTON(widgets->NextButton),NEXT_LABEL); - GtkWidget *image = gtk_button_get_image(GTK_BUTTON(widgets->NextButton)); - gtk_image_set_from_icon_name(GTK_IMAGE(image),arrow_right_icon_path,GTK_ICON_SIZE_BUTTON); - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->LicenseAgreeRadio))){ - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_SECTIONS); - } else { - gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_WELCOME); } - yon_page_update(widgets); - main_config.save_done=0; - main_config.install_complete=0; - main_config.install_thread=0; } } diff --git a/source/ubinstall-gtk-saving.c b/source/ubinstall-gtk-saving.c index 13bfc11..c687017 100644 --- a/source/ubinstall-gtk-saving.c +++ b/source/ubinstall-gtk-saving.c @@ -188,6 +188,7 @@ void *on_config_save(void *data){ char *command = yon_debug_output("%s\n",save_config_command(yon_char_parsed_to_string(parameters,size," "))); yon_char_parsed_free(parameters,size); yon_debug_output("%s\n","Entered installation"); + printf("1\n"); if (system(yon_debug_output("%s\n",command))){ gdk_threads_add_idle((GSourceFunc)on_install_error,widgets); diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 64eb6b5..09f67cf 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -101,65 +101,66 @@ void yon_on_about(GtkWidget *, main_window *){ //functions -int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){ - textdomain(template_ui_LocaleName); - GtkWidget *dialog = gtk_dialog_new_with_buttons(TITLE_LABEL,GTK_WINDOW(gtk_widget_get_toplevel(self)),GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL); - textdomain(LocaleName); - gtk_window_set_modal(GTK_WINDOW(dialog),1); - gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); - gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); - gtk_widget_set_size_request(dialog,450,-1); - GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_header_bar(GTK_DIALOG(dialog)))); - GtkWidget *image_cancel = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.cancel-symbolic",GTK_ICON_SIZE_BUTTON); - GtkWidget *image_accept = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.accept-symbolic",GTK_ICON_SIZE_BUTTON); - gtk_button_set_image((GtkButton*)g_list_nth_data(list,0),image_cancel); - gtk_button_set_image((GtkButton*)g_list_nth_data(list,1),image_accept); - gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,0)),"marginright"); - gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,1)),"marginright"); - - g_list_free(list); - GtkWidget *header_label = gtk_label_new(yon_char_is_empty(data->title)?TITLE_LABEL:data->title); - gtk_widget_show(header_label); - PangoAttrList *attributes = pango_attr_list_new(); - PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD); - pango_attr_list_insert(attributes, boldAttr); - gtk_label_set_attributes(GTK_LABEL(header_label),attributes); - - GtkWidget *header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); - gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label); - gtk_widget_show(header); - - GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_DIALOG); - gtk_widget_show(image); - gtk_widget_set_margin_start(image,20); - gtk_widget_set_margin_end(image,20); - gtk_widget_set_margin_bottom(image,20); - gtk_widget_set_margin_top(image,20); - - GtkWidget *label = gtk_label_new(""); - gtk_widget_set_margin_end(label,20); - gtk_widget_show(label); - gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD); - gtk_label_set_line_wrap(GTK_LABEL(label),1); - gtk_label_set_markup(GTK_LABEL(label),data->action_text); - - GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); - gtk_widget_show(box); - gtk_box_pack_start(GTK_BOX(box),image,0,0,5); - gtk_box_pack_start(GTK_BOX(box),label,0,0,5); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5); - - gtk_window_set_default_size(GTK_WINDOW(dialog),450,-1); - - int resp = gtk_dialog_run(GTK_DIALOG(dialog)); - if (resp == GTK_RESPONSE_ACCEPT){ - if (data->function){ - data->function(NULL,data->data); - } - } else resp=0; - gtk_widget_destroy(dialog); - return resp; -} +// int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){ +// textdomain(template_ui_LocaleName); +// GtkWindow *parent = self?GTK_WINDOW(gtk_widget_get_toplevel(self)):NULL; +// GtkWidget *dialog = gtk_dialog_new_with_buttons(TITLE_LABEL,parent,GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL); +// textdomain(LocaleName); +// gtk_window_set_modal(GTK_WINDOW(dialog),1); +// gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",LocaleName)); +// gtk_window_set_title(GTK_WINDOW(dialog),TITLE_LABEL); +// gtk_widget_set_size_request(dialog,450,-1); +// GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_header_bar(GTK_DIALOG(dialog)))); +// GtkWidget *image_cancel = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.cancel-symbolic",GTK_ICON_SIZE_BUTTON); +// GtkWidget *image_accept = gtk_image_new_from_icon_name("com.ublinux.libublsettingsui-gtk3.accept-symbolic",GTK_ICON_SIZE_BUTTON); +// gtk_button_set_image((GtkButton*)g_list_nth_data(list,0),image_cancel); +// gtk_button_set_image((GtkButton*)g_list_nth_data(list,1),image_accept); +// gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,0)),"marginright"); +// gtk_style_context_add_class(gtk_widget_get_style_context((GtkWidget*)g_list_nth_data(list,1)),"marginright"); + +// g_list_free(list); +// GtkWidget *header_label = gtk_label_new(yon_char_is_empty(data->title)?TITLE_LABEL:data->title); +// gtk_widget_show(header_label); +// PangoAttrList *attributes = pango_attr_list_new(); +// PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD); +// pango_attr_list_insert(attributes, boldAttr); +// gtk_label_set_attributes(GTK_LABEL(header_label),attributes); + +// GtkWidget *header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog)); +// gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label); +// gtk_widget_show(header); + +// GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_DIALOG); +// gtk_widget_show(image); +// gtk_widget_set_margin_start(image,20); +// gtk_widget_set_margin_end(image,20); +// gtk_widget_set_margin_bottom(image,20); +// gtk_widget_set_margin_top(image,20); + +// GtkWidget *label = gtk_label_new(""); +// gtk_widget_set_margin_end(label,20); +// gtk_widget_show(label); +// gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD); +// gtk_label_set_line_wrap(GTK_LABEL(label),1); +// gtk_label_set_markup(GTK_LABEL(label),data->action_text); + +// GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); +// gtk_widget_show(box); +// gtk_box_pack_start(GTK_BOX(box),image,0,0,5); +// gtk_box_pack_start(GTK_BOX(box),label,0,0,5); +// gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5); + +// gtk_window_set_default_size(GTK_WINDOW(dialog),450,-1); + +// int resp = gtk_dialog_run(GTK_DIALOG(dialog)); +// if (resp == GTK_RESPONSE_ACCEPT){ +// if (data->function){ +// data->function(NULL,data->data); +// } +// } else resp=0; +// gtk_widget_destroy(dialog); +// return resp; +// } // //functions // void yon_encryption_type_setup(GtkComboBoxText *target){ @@ -464,7 +465,7 @@ void on_locale_changed(GtkWidget *,main_window *widgets){ GtkTreeModel *model; if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->LanguagesTree)),&model,&iter)) return; gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter)); - char *config_code = config(installer_lang_parameter); + char *config_code = config(installer_locale_parameter); if (yon_char_is_empty(config_code)){ config_code = setlocale(LC_ALL,NULL); } @@ -492,13 +493,13 @@ void on_installer_language_changed(GtkWidget *self,GtkTreePath*,GtkTreeViewColum if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&model,&iter)) return; gtk_tree_model_get(model,&iter,2,&window_language,-1); if (!yon_char_is_empty(window_language)){ - char *prev_lang = config(installer_lang_parameter); + char *prev_lang = config(installer_locale_parameter); if (!yon_char_is_empty(prev_lang)&&!strcmp(prev_lang,window_language)) return; - yon_config_register(installer_lang_parameter,installer_lang_parameter_command,(char*)window_language); + yon_config_register(installer_locale_parameter,installer_locale_parameter_command,(char*)window_language); } char *active_lang_id = gtk_tree_model_get_string_from_iter(model,&iter); int size; - config_str parameters = yon_config_get_save_parameters_by_key(&size,installer_lang_parameter,NULL); + config_str parameters = yon_config_get_save_parameters_by_key(&size,installer_locale_parameter,NULL); char *command_parameters = yon_char_parsed_to_string(parameters,size," "); char *command = yon_char_unite(ubconfig_dull_command,"--target system ",command_parameters,NULL); g_signal_handlers_block_by_func(G_OBJECT(widgets->MainWindow),G_CALLBACK(on_yon_exit),widgets); @@ -537,7 +538,7 @@ void set_locales_list(main_window *widgets){ gtk_list_store_clear(widgets->InstallerLanguageList); gtk_list_store_clear(widgets->InstallerCountryList); - char *config_code = yon_char_new(config(installer_lang_parameter)); + char *config_code = yon_char_new(config(installer_locale_parameter)); int size; config_str locales = yon_locale_get_all_codes(&size); qsort(locales,size,sizeof(char*),yon_char_parsed_compare); @@ -604,7 +605,7 @@ gboolean on_country_filter(GtkTreeModel *self, GtkTreeIter *iter, main_window *w char *code; gtk_tree_model_get(model,&itar,0,&code,-1); if (!strcmp(code,cur_code)){ - char *config_lang = config(installer_lang_parameter); + char *config_lang = config(installer_locale_parameter); if (!yon_char_is_empty(config_lang)&&!strcmp(cur_code,config_lang)){ if (gtk_tree_model_filter_convert_child_iter_to_iter(GTK_TREE_MODEL_FILTER(widgets->InstallerCountryFilter),iter,&itar)){ gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->CountryLanguagesTree)),&itar); @@ -1160,13 +1161,19 @@ void yon_main_window_create(main_window *widgets){ gtk_widget_hide(widgets->StartScenarioButton); } if (main_config.force_ini){ - main_config.configure_mode=1; - g_signal_handlers_block_by_func(G_OBJECT(widgets->ConfigurationModeMenuItem),G_CALLBACK(on_configuration_mode_switch),widgets); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1); - gtk_widget_set_sensitive(widgets->ConfigurationModeMenuItem,0); - g_signal_handlers_unblock_by_func(G_OBJECT(widgets->ConfigurationModeMenuItem),G_CALLBACK(on_configuration_mode_switch),widgets); - yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox),"config_mode",CONFIGURATION_MODE_STATUS_LABEL,BACKGROUND_IMAGE_INFO_TYPE); - yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox2),"config_mede",CONFIG_PATH_LABEL(main_config.config_save_path),BACKGROUND_IMAGE_INFO_TYPE); + if (yon_configuration_path_check(main_config.config_save_path)){ + main_config.configure_mode=1; + GList *box = gtk_container_get_children(GTK_CONTAINER(widgets->ConfigurationModeMenuItem)); + GList *children = gtk_container_get_children(GTK_CONTAINER(box->data)); + + GtkWidget *Check = GTK_WIDGET(g_list_nth_data(children,1)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Check),1); + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox),"config_mode",CONFIGURATION_MODE_STATUS_LABEL,BACKGROUND_IMAGE_INFO_TYPE); + yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(widgets->StatusBox2),"config_mede",CONFIG_PATH_LABEL(main_config.config_save_path),BACKGROUND_IMAGE_INFO_TYPE); + } else { + gtk_main_quit(); + exit (1); + } } yon_locale_init(); set_locales_list(widgets); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index f8f53fa..0acc53a 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -254,8 +254,8 @@ layout && /description:/ {\ #define NETWORK_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[", target, "@connmod]']", NULL) #define NETWORK_devdown_parameter_command(target) yon_char_unite("ubconfig get autoinstall AUTOINSTALL['ubconfig set [network] NETWORK[", target, "@devdown]']", NULL) #define NETWORK(target) yon_char_unite("NETWORK[", target, "@connmod]", NULL) -#define installer_lang_parameter "AUTOINSTALL[installer_lang]" -#define installer_lang_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[installer_lang]" +#define installer_locale_parameter "AUTOINSTALL[installer_locale]" +#define installer_locale_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[installer_lang]" #define source_parameter "AUTOINSTALL[source]" #define source_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[source]" @@ -1162,6 +1162,7 @@ gboolean on_install_error(main_window *widgets); void on_reboot_accepted(main_window *widgets); +int yon_configuration_path_check(const char *path); void on_keyboard_clicked(GtkWidget *, main_window *widgets); void on_keyboard_accept(GtkWidget *self, main_window *widgets); void on_layout_toggle(GtkCellRendererToggle *, gchar *path, ubinstall_keyboard_window *window);