diff --git a/source/ubl-settings-kernel.c b/source/ubl-settings-kernel.c index 78a8729..dbd3484 100644 --- a/source/ubl-settings-kernel.c +++ b/source/ubl-settings-kernel.c @@ -66,28 +66,32 @@ void on_config_save(GtkWidget *, main_window *widgets){ main_config.save_config=2; template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,yon_config_get_custom_command("global"),NULL); if (window){}; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } void on_config_global_save(GtkWidget *, main_window *widgets){ main_config.save_config=0; template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,yon_config_get_custom_command("global"),NULL); if (window){}; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } void on_config_local_save(GtkWidget *, main_window *widgets){ main_config.save_config=1; template_saving_window *window = yon_save_proceed("system",YON_CONFIG_LOCAL,yon_config_get_custom_command("system"),NULL); if (window){}; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } void on_config_custom_save(GtkWidget *, main_window *widgets){ main_config.save_config=1; template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_CUSTOM,yon_config_get_custom_command("system"),NULL); if (window){}; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } @@ -97,7 +101,8 @@ void on_config_local_load(GtkWidget *, main_window *widgets){ yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocaleName); main_config.load_mode=1; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } void on_config_global_load(GtkWidget *, main_window *widgets){ @@ -106,7 +111,8 @@ void on_config_global_load(GtkWidget *, main_window *widgets){ yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocaleName); main_config.load_mode=0; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } void on_config_custom_load(GtkWidget *,main_window *widgets){ @@ -115,7 +121,8 @@ void on_config_custom_load(GtkWidget *,main_window *widgets){ yon_ubl_status_box_render(GLOBAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); textdomain(LocaleName); main_config.load_mode=3; - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } gboolean yon_tab_create_tags(kernels_tab *tab){ @@ -173,7 +180,9 @@ gboolean yon_tab_create_tags(kernels_tab *tab){ char *launched = config(KERNEL_BOOT_parameter); int boot_size; config_str boot_run = yon_config_load(get_active_kernel_command,&boot_size); - yon_char_remove_last_symbol(boot_run[0],'\n'); + if (boot_size>0){ + yon_char_remove_last_symbol(boot_run[0],'\n'); + } if ((!(launched&&!strcmp(tab->package,launched))&&(strcmp(tab->package,boot_run[0])))){ gtk_widget_show(tab->launch_button); @@ -383,7 +392,8 @@ gboolean on_command_execute_success(GtkWidget *,gint status,main_window *widgets g_mutex_unlock(&main_config.progress_mutex); if (!status){ yon_ubl_status_box_render(OPERATION_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } else { yon_ubl_status_box_render(OPERATION_ERROR_LABEL,BACKGROUND_IMAGE_FAIL_TYPE); } @@ -432,7 +442,8 @@ gboolean yon_terminal_get_progress(main_window *widgets){ void *yon_command_execute_async(char *command,main_window *widgets){ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->InstallationProgress),0); vte_terminal_reset(VTE_TERMINAL(widgets->InstallTerminal),0,1); - yon_terminal_integrated_start_shell(widgets->InstallTerminal,yon_debug_output("%s\n",command),on_command_execute_success,widgets); + yon_terminal_integrated_start_shell(widgets->InstallTerminal,yon_debug_output("%s\n",command),NULL,NULL); + g_signal_connect_after(G_OBJECT(widgets->InstallTerminal),"child-exited",G_CALLBACK(on_command_execute_success),widgets); // yon_terminal_integrated_start(widgets->InstallTerminal,yon_debug_output("%s\n",command)); glong columns = vte_terminal_get_column_count(VTE_TERMINAL(widgets->InstallTerminal)); vte_terminal_set_size(VTE_TERMINAL(widgets->InstallTerminal),columns,20); @@ -608,8 +619,33 @@ void on_module_remove_done(GtkWidget *self, int state, kernels_tab *tab){ void on_module_remove_clicked(GtkWidget *self,dictionary *dict){ main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); kernels_tab *tab = yon_dictionary_get_data(dict->first->next,kernels_tab*); + int size; + config_str cnf = yon_config_load(SAVE_MODE_GET_COMMAND,&size); + yon_char_remove_last_symbol(cnf[0],'\n'); + SAVE_MODE_TYPE type = yon_ubl_save_mode_get_type(cnf[0]); + int installed_kernels=0; + dictionary *cur_ker=NULL; + for_dictionaries(cur_ker,main_config.kernel_tabs){ + switch(type){ + case SAVE_MODE_RAM_HOME: + case SAVE_MODE_SANDBOX:{ + if (((kernels_tab*)cur_ker->data)->module_installed){ + installed_kernels++; + } break; + default: + if (((kernels_tab*)cur_ker->data)->package_installed||((kernels_tab*)cur_ker->data)->module_installed){ + installed_kernels++; + } + + } break; + } + } dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data)); - data->action_text = KERNEL_MODULE_REMOVE_CONFIRMATION_LABEL(tab->name); + if (installed_kernels>1){ + data->action_text = KERNEL_MODULE_REMOVE_CONFIRMATION_LABEL(tab->name); + } else if (installed_kernels==1){ + data->action_text = KERNEL_REMOVE_LAST_CONFIRMATION_LABEL(tab->name); + } data->function = NULL; data->data = NULL; if (yon_confirmation_dialog_call(self,data) == GTK_RESPONSE_ACCEPT){ @@ -627,8 +663,33 @@ void on_module_remove_clicked(GtkWidget *self,dictionary *dict){ void on_package_remove_clicked(GtkWidget *self,dictionary *dict){ main_window *widgets = yon_dictionary_get_data(dict->first,main_window*); kernels_tab *tab = yon_dictionary_get_data(dict->first->next,kernels_tab*); + int size; + config_str cnf = yon_config_load(SAVE_MODE_GET_COMMAND,&size); + yon_char_remove_last_symbol(cnf[0],'\n'); + SAVE_MODE_TYPE type = yon_ubl_save_mode_get_type(cnf[0]); + int installed_kernels=0; + dictionary *cur_ker=NULL; + for_dictionaries(cur_ker,main_config.kernel_tabs){ + switch(type){ + case SAVE_MODE_RAM_HOME: + case SAVE_MODE_SANDBOX:{ + if (((kernels_tab*)cur_ker->data)->module_installed){ + installed_kernels++; + } break; + default: + if (((kernels_tab*)cur_ker->data)->package_installed||((kernels_tab*)cur_ker->data)->module_installed){ + installed_kernels++; + } + + } break; + } + } dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data)); - data->action_text = KERNEL_PACKAGE_REMOVE_CONFIRMATION_LABEL(tab->name); + if (installed_kernels>1){ + data->action_text = KERNEL_PACKAGE_REMOVE_CONFIRMATION_LABEL(tab->name); + } else if (installed_kernels==1){ + data->action_text = KERNEL_REMOVE_LAST_CONFIRMATION_LABEL(tab->name); + } data->function = NULL; data->data = NULL; int resp = yon_confirmation_dialog_call(self,data); @@ -650,7 +711,8 @@ void on_launch_cliked(GtkWidget *self,dictionary *dict){ data->data = NULL; if (yon_confirmation_dialog_call(self,data) == GTK_RESPONSE_ACCEPT){ yon_config_set(KERNEL_BOOT_parameter,tab->package); - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); + } } @@ -864,8 +926,8 @@ void on_update_clicked(GtkWidget *, main_window *widgets){ yon_dictionary_free_all(main_config.addition_tabs,free); main_config.kernel_tabs=NULL; main_config.addition_tabs=NULL; - yon_interface_update(widgets); + } } @@ -1047,6 +1109,11 @@ void yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->LoadLocalMenuItem),"activate",G_CALLBACK(on_config_local_load),widgets); g_signal_connect(G_OBJECT(widgets->LoadCustomMenuItem),"activate",G_CALLBACK(on_config_custom_load),widgets); + int paned_pos=0; + if (yon_window_config_get_parameter("settings","paned_pos",&paned_pos,YON_TYPE_INT)) { + gtk_paned_set_position(GTK_PANED(widgets->TerminalPaned),paned_pos); + } + yon_root_button_setup((template_main_window*)widgets,main_config.launch_arguments,main_config.launch_size); if (getuid()){ gtk_widget_set_sensitive(widgets->BuildingButton,0); @@ -1062,7 +1129,7 @@ void yon_main_window_complete(main_window *widgets){ gtk_paned_add2(GTK_PANED(widgets->TerminalPaned),widgets->TerminalRevealer); - yon_interface_update(widgets); + on_update_clicked(NULL,widgets); yon_save_window_set_postsave_function(on_save_done,widgets); } yon_load_proceed(YON_CONFIG_LOCAL); diff --git a/source/ubl-strings.h b/source/ubl-strings.h index a7871cf..7fc60dc 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -66,6 +66,7 @@ #define KERNEL_MODULE_UPDATE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to update kernel module")," ",target,"?",NULL) #define KERNEL_PACKAGE_UPDATE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to update kernel package")," ",target,"?",NULL) #define KERNEL_MODULE_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove kernel module")," ",target,"?",NULL) +#define KERNEL_REMOVE_LAST_CONFIRMATION_LABEL(target) yon_char_unite(_("The kernel is the only one in the system. If you remove it, it will become impossible to boot. Do you really want to remove")," ",target,"?",NULL) #define KERNEL_PACKAGE_REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove kernel package")," ",target,"?",NULL) #define ADDITION_MODULE_INSTALL_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to install kernel addition package")," ",target,"?",NULL) #define ADDITION_PACKAGE_INSTALL_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to install kernel addition package")," ",target,"?",NULL) diff --git a/ubl-settings-kernel.pot b/ubl-settings-kernel.pot index 71c80d0..9251b21 100644 --- a/ubl-settings-kernel.pot +++ b/ubl-settings-kernel.pot @@ -234,44 +234,50 @@ msgid "Are you sure want to remove kernel module" msgstr "" #: source/ubl-strings.h:69 +msgid "" +"The kernel is the only one in the system. If you remove it, it will become " +"impossible to boot. Do you really want to remove" +msgstr "" + +#: source/ubl-strings.h:70 msgid "Are you sure want to remove kernel package" msgstr "" -#: source/ubl-strings.h:70 source/ubl-strings.h:71 +#: source/ubl-strings.h:71 source/ubl-strings.h:72 msgid "Are you sure want to install kernel addition package" msgstr "" -#: source/ubl-strings.h:72 +#: source/ubl-strings.h:73 msgid "Are you sure want to update kernel addition module" msgstr "" -#: source/ubl-strings.h:73 +#: source/ubl-strings.h:74 msgid "Are you sure want to update kernel addition package" msgstr "" -#: source/ubl-strings.h:74 +#: source/ubl-strings.h:75 msgid "Are you sure want to remove kernel addition module" msgstr "" -#: source/ubl-strings.h:75 +#: source/ubl-strings.h:76 msgid "Are you sure want to remove kernel addition package" msgstr "" -#: source/ubl-strings.h:76 +#: source/ubl-strings.h:77 msgid "Are you sure want to launch" msgstr "" -#: source/ubl-strings.h:76 +#: source/ubl-strings.h:77 msgid "" "for boot?\n" "\n" "Changes will be applied after system restart" msgstr "" -#: source/ubl-strings.h:78 +#: source/ubl-strings.h:79 msgid "Update module" msgstr "" -#: source/ubl-strings.h:79 +#: source/ubl-strings.h:80 msgid "Update package" msgstr "" diff --git a/ubl-settings-kernel_ru.po b/ubl-settings-kernel_ru.po index 7095baf..81dc4ac 100644 --- a/ubl-settings-kernel_ru.po +++ b/ubl-settings-kernel_ru.po @@ -238,34 +238,40 @@ msgid "Are you sure want to remove kernel module" msgstr "Вы действительно хотите удалить из системы пакет с модулем ядра" #: source/ubl-strings.h:69 +msgid "" +"The kernel is the only one in the system. If you remove it, it will become " +"impossible to boot. Do you really want to remove" +msgstr "Ядро является единственным в системе. При удалении загрузка станет невозможна. Вы действительно хотите удалить" + +#: source/ubl-strings.h:70 msgid "Are you sure want to remove kernel package" msgstr "Вы действительно хотите удалить из системы пакет с ядром" -#: source/ubl-strings.h:70 source/ubl-strings.h:71 +#: source/ubl-strings.h:71 source/ubl-strings.h:72 msgid "Are you sure want to install kernel addition package" msgstr "Вы хотите установить в систему пакет с модулем дополнения" -#: source/ubl-strings.h:72 +#: source/ubl-strings.h:73 msgid "Are you sure want to update kernel addition module" msgstr "Вы хотите обновить пакет с модулем дополнения" -#: source/ubl-strings.h:73 +#: source/ubl-strings.h:74 msgid "Are you sure want to update kernel addition package" msgstr "Вы действительно хотите обновить пакет с дополнением" -#: source/ubl-strings.h:74 +#: source/ubl-strings.h:75 msgid "Are you sure want to remove kernel addition module" msgstr "Вы действительно хотите удалить из системы пакет с модулем дополнения" -#: source/ubl-strings.h:75 +#: source/ubl-strings.h:76 msgid "Are you sure want to remove kernel addition package" msgstr "Вы действительно хотите удалить из системы пакет с дополнением" -#: source/ubl-strings.h:76 +#: source/ubl-strings.h:77 msgid "Are you sure want to launch" msgstr "Выбрать ядро" -#: source/ubl-strings.h:76 +#: source/ubl-strings.h:77 msgid "" "for boot?\n" "\n" @@ -275,10 +281,10 @@ msgstr "" "\n" "Изменения вступят в силу после перезагрузки." -#: source/ubl-strings.h:78 +#: source/ubl-strings.h:79 msgid "Update module" msgstr "Обновить модуль" -#: source/ubl-strings.h:79 +#: source/ubl-strings.h:80 msgid "Update package" msgstr "Обновить пакет"