diff --git a/gresource.xml b/gresource.xml index 0d500b3..3449e5e 100644 --- a/gresource.xml +++ b/gresource.xml @@ -5,6 +5,7 @@ ubl-settings-kernel-info.glade ubl-settings-kernel-install.glade ubl-settings-kernel-table-row.glade + ubl-settings-kernel-additions-table-row.glade ubl-settings-kernel.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 315f5a8..450e841 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -35,6 +35,7 @@ set(DEPENDFILES ../ubl-settings-kernel-info.glade ../ubl-settings-kernel-install.glade ../ubl-settings-kernel-table-row.glade + ../ubl-settings-kernel-additions-table-row.glade ../gresource.xml ../kernel-list.csv ../kernel-list-addon.csv @@ -66,7 +67,7 @@ add_custom_target( set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wmissing-declarations -fdiagnostics-color=always \ -O2 -pipe -fno-plt -fexceptions \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ - -fstack-clash-protection -fcf-protection") + -fstack-clash-protection -fcf-protection -fsanitize=thread") set(SOURCE_FILES ubl-settings-kernel.c diff --git a/source/ubl-settings-kernel.c b/source/ubl-settings-kernel.c index 988e330..b8b0071 100644 --- a/source/ubl-settings-kernel.c +++ b/source/ubl-settings-kernel.c @@ -39,17 +39,101 @@ void yon_load_proceed(YON_CONFIG_TYPE type){ } } -void yon_interface_update(main_window *widgets){ - GList *list = gtk_container_get_children(GTK_CONTAINER(widgets->KernelsPackageBox)); - for (guint i=0;iKernelsPackageBox)); + for (guint i=0;iAdditionsPackageBox)); + for (guint i=0;iKernelsPackageBox),kernels[i],widgets); + if (!yon_char_is_empty(boot_run)&&!strcmp(tab->package,boot_run)){ + yon_tag_add(GTK_BOX(tab->run_tags_box),BOOT_RUN_LABEL,"tag_orange",NULL); + gtk_widget_hide(tab->launch_button); + gtk_widget_hide(tab->remove_module_button); + gtk_widget_hide(tab->remove_package_button); + } + gtk_widget_set_can_focus(gtk_widget_get_parent(tab->main_box),0); + } + yon_char_parsed_free(kernels,kernels_size); + kernels = yon_resource_open_file(kernels_addon_path, &kernels_size); for (int i=1;iKernelsPackageBox),kernels[i],widgets); - gtk_widget_set_can_focus(gtk_widget_get_parent(current),0); + additions_kernels_tab *tab = yon_additions_tab_row_new(GTK_LIST_BOX(widgets->AdditionsPackageBox),kernels[i],widgets); + gtk_widget_set_can_focus(gtk_widget_get_parent(tab->main_box),0); } + g_mutex_unlock(&main_config.mutex); + return NULL; } info_window *yon_info_window_new(){ @@ -106,7 +190,7 @@ int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name gboolean on_command_execute_success(GtkWidget *,gint,main_window *widgets){ gtk_revealer_set_transition_type(GTK_REVEALER(widgets->MainRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN); gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->MainRevealer),0); - yon_interface_update(widgets); + yon_interface_update(widgets); return G_SOURCE_REMOVE; } @@ -125,6 +209,7 @@ void on_module_install_clicked(GtkWidget *,dictionary *dict){ kernels_tab *tab = yon_dictionary_get_data(dict->first->next,kernels_tab*); char *command = install_command(tab->module); yon_command_execute_async(command,widgets); + tab->module_installed=1; } @@ -133,6 +218,7 @@ void on_package_install_clicked(GtkWidget *,dictionary *dict){ kernels_tab *tab = yon_dictionary_get_data(dict->first->next,kernels_tab*); char *command = install_command(tab->package); yon_command_execute_async(command,widgets); + tab->package_installed=1; } @@ -141,6 +227,7 @@ void on_module_remove_clicked(GtkWidget *,dictionary *dict){ kernels_tab *tab = yon_dictionary_get_data(dict->first->next,kernels_tab*); char *command = remove_command(tab->module); yon_command_execute_async(command,widgets); + tab->module_installed=0; } @@ -149,108 +236,272 @@ void on_package_remove_clicked(GtkWidget *,dictionary *dict){ kernels_tab *tab = yon_dictionary_get_data(dict->first->next,kernels_tab*); char *command = remove_command(tab->package); yon_command_execute_async(command,widgets); + tab->package_installed=0; } -GtkWidget *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets){ - GtkBuilder *builder = gtk_builder_new_from_resource(glade_table_row_path); - - kernels_tab *tab = malloc(sizeof(kernels_tab)); - tab->main_box = yon_gtk_builder_get_widget(builder,"TableRowLabel"); - tab->name_label = yon_gtk_builder_get_widget(builder,"NameLabel"); - tab->module_label = yon_gtk_builder_get_widget(builder,"ModuleLabel"); - tab->package_label = yon_gtk_builder_get_widget(builder,"PackageLabel"); - tab->module_icon = yon_gtk_builder_get_widget(builder,"ModuleIcon"); - tab->package_icon = yon_gtk_builder_get_widget(builder,"PackageIcon"); - tab->module_label = yon_gtk_builder_get_widget(builder,"ModuleLabel"); - tab->package_label = yon_gtk_builder_get_widget(builder,"PackageLabel"); - tab->install_tags_box = yon_gtk_builder_get_widget(builder,"InstallTagsBox"); - tab->run_tags_box = yon_gtk_builder_get_widget(builder,"RunBox"); - tab->tags_box = yon_gtk_builder_get_widget(builder,"TagsBox"); - tab->description_label = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); - tab->remove_module_button = yon_gtk_builder_get_widget(builder,"RemoveModuleButton"); - tab->remove_package_button = yon_gtk_builder_get_widget(builder,"RemovePackageButton"); - tab->install_module_button = yon_gtk_builder_get_widget(builder,"InstallModuleButton"); - tab->install_package_button = yon_gtk_builder_get_widget(builder,"InstallPackageButton"); - tab->changelog_button = yon_gtk_builder_get_widget(builder,"ChangelogButton"); - - dictionary *dict = NULL; - yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); - yon_dictionary_add_or_create_if_exists_with_data(dict,"tab",tab); - g_signal_connect(G_OBJECT(tab->install_module_button),"clicked",G_CALLBACK(on_module_install_clicked),dict); - g_signal_connect(G_OBJECT(tab->install_package_button),"clicked",G_CALLBACK(on_package_install_clicked),dict); - g_signal_connect(G_OBJECT(tab->remove_module_button),"clicked",G_CALLBACK(on_module_remove_clicked),dict); - g_signal_connect(G_OBJECT(tab->remove_package_button),"clicked",G_CALLBACK(on_package_remove_clicked),dict); - g_signal_connect(G_OBJECT(tab->changelog_button),"clicked",G_CALLBACK(on_changelog_clicked),tab); - gtk_list_box_insert(target,tab->main_box,-1); +void on_launch_cliked(GtkWidget *,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*); + yon_config_set(KERNEL_BOOT_parameter,tab->package); + yon_interface_update(widgets); +} +kernels_tab *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets){ int size; config_str parsed = yon_char_parse(target_string,&size,";"); if (size){ - char *boot_run = config(KERNEL_BOOT_parameter); - if (!yon_char_is_empty(boot_run)&&!strcmp(parsed[1],boot_run)){ - yon_tag_add(GTK_BOX(tab->run_tags_box),BOOT_RUN_LABEL,"tag_orange",restart_icon_path); - } - tab->name = yon_char_new(parsed[0]); - tab->module = yon_char_new(parsed[1]); - tab->package = yon_char_new(parsed[2]); - char *name = yon_char_unite("",tab->name,"",NULL); - char *module = yon_char_unite("",MODULE_LABEL," ",tab->module,"",NULL); - char *package = yon_char_unite("",PACKAGE_LABEL," ",tab->package,"",NULL); int types_size; - config_str types_parsed = yon_char_parse(parsed[5],&types_size,", "); - for (int k=0;ktags_box),types_parsed[k],tag_type,NULL); - } - char *check_install_command = get_package_is_installed_command(tab->module); - if (!system(check_install_command)){ - yon_tag_add(GTK_BOX(tab->install_tags_box),MODULE_INSTALLED_LABEL,"tag_green",NULL); - - gtk_image_set_from_icon_name(GTK_IMAGE(tab->module_icon),module_icon_path,GTK_ICON_SIZE_BUTTON); - gtk_widget_show(tab->remove_module_button); - gtk_widget_show(tab->remove_package_button); - gtk_widget_hide(tab->install_module_button); - gtk_widget_hide(tab->install_package_button); - } - { - free(check_install_command); - check_install_command = get_package_is_installed_command(tab->package); - if (!system(check_install_command)){ - yon_tag_add(GTK_BOX(tab->install_tags_box),PACKAGE_INSTALLED_LABEL,"tag_green",NULL); - gtk_image_set_from_icon_name(GTK_IMAGE(tab->package_icon),package_icon_path,GTK_ICON_SIZE_BUTTON); + dictionary *cur = yon_dictionary_get(&main_config.kernel_tabs,parsed[2]); + kernels_tab *tab = NULL; + if (cur){ + tab = (kernels_tab*)cur->data; + GList *list = gtk_container_get_children(GTK_CONTAINER(tab->install_tags_box)); + for (guint i=0;ichangelog_button); + gtk_widget_show(tab->launch_button); + if (tab->module_installed){ + gtk_widget_show(tab->remove_module_button); + gtk_widget_hide(tab->install_module_button); + gtk_widget_show(tab->remove_module_button); + yon_tag_add(GTK_BOX(tab->install_tags_box),MODULE_INSTALLED_LABEL,"tag_green",NULL); + } else { + gtk_widget_hide(tab->remove_module_button); + gtk_widget_show(tab->install_module_button); + + } + if (tab->package_installed){ + gtk_widget_show(tab->remove_package_button); gtk_widget_hide(tab->install_package_button); + gtk_widget_show(tab->changelog_button); + yon_tag_add(GTK_BOX(tab->install_tags_box),PACKAGE_INSTALLED_LABEL,"tag_green",NULL); + + } else { + gtk_widget_hide(tab->remove_package_button); + gtk_widget_show(tab->install_package_button); + + } + if (!tab->package_installed&&!tab->module_installed){ + gtk_widget_hide(tab->launch_button); + } + } else { + + tab = malloc(sizeof(kernels_tab)); + + GtkBuilder *builder = gtk_builder_new_from_resource(glade_table_row_path); + tab->main_box = yon_gtk_builder_get_widget(builder,"TableRowLabel"); + tab->name_label = yon_gtk_builder_get_widget(builder,"NameLabel"); + tab->module_label = yon_gtk_builder_get_widget(builder,"ModuleLabel"); + tab->package_label = yon_gtk_builder_get_widget(builder,"PackageLabel"); + tab->module_icon = yon_gtk_builder_get_widget(builder,"ModuleIcon"); + tab->package_icon = yon_gtk_builder_get_widget(builder,"PackageIcon"); + tab->module_label = yon_gtk_builder_get_widget(builder,"ModuleLabel"); + tab->package_label = yon_gtk_builder_get_widget(builder,"PackageLabel"); + tab->install_tags_box = yon_gtk_builder_get_widget(builder,"InstallTagsBox"); + tab->run_tags_box = yon_gtk_builder_get_widget(builder,"RunBox"); + tab->tags_box = yon_gtk_builder_get_widget(builder,"TagsBox"); + tab->description_label = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); + tab->remove_module_button = yon_gtk_builder_get_widget(builder,"RemoveModuleButton"); + tab->remove_package_button = yon_gtk_builder_get_widget(builder,"RemovePackageButton"); + tab->install_module_button = yon_gtk_builder_get_widget(builder,"InstallModuleButton"); + tab->install_package_button = yon_gtk_builder_get_widget(builder,"InstallPackageButton"); + tab->changelog_button = yon_gtk_builder_get_widget(builder,"ChangelogButton"); + tab->launch_button = yon_gtk_builder_get_widget(builder,"LaunchButton"); + + dictionary *dict = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dict,"tab",tab); + g_signal_connect(G_OBJECT(tab->install_module_button),"clicked",G_CALLBACK(on_module_install_clicked),dict); + g_signal_connect(G_OBJECT(tab->install_package_button),"clicked",G_CALLBACK(on_package_install_clicked),dict); + g_signal_connect(G_OBJECT(tab->remove_module_button),"clicked",G_CALLBACK(on_module_remove_clicked),dict); + g_signal_connect(G_OBJECT(tab->remove_package_button),"clicked",G_CALLBACK(on_package_remove_clicked),dict); + g_signal_connect(G_OBJECT(tab->changelog_button),"clicked",G_CALLBACK(on_changelog_clicked),tab); + g_signal_connect(G_OBJECT(tab->launch_button),"clicked",G_CALLBACK(on_launch_cliked),dict); + tab->module_installed=-1; + tab->package_installed=-1; + tab->name = yon_char_new(parsed[0]); + tab->module = yon_char_new(parsed[1]); + tab->package = yon_char_new(parsed[2]); + char *name = yon_char_unite("",tab->name,"",NULL); + char *module = yon_char_unite("",MODULE_LABEL," ",tab->module,"",NULL); + char *package = yon_char_unite("",PACKAGE_LABEL," ",tab->package,"",NULL); + + yon_dictionary_add_or_create_if_exists_with_data(main_config.kernel_tabs,tab->package,tab); + + gtk_list_box_insert(target,tab->main_box,-1); + config_str types_parsed = yon_char_parse(parsed[5],&types_size,", "); + for (int k=0;ktags_box),types_parsed[k],tag_type,NULL); + } + char *check_install_command = get_package_is_installed_command(tab->module); + if (!system(check_install_command)){ + yon_tag_add(GTK_BOX(tab->install_tags_box),MODULE_INSTALLED_LABEL,"tag_green",NULL); + tab->module_installed=1; + + gtk_image_set_from_icon_name(GTK_IMAGE(tab->module_icon),module_icon_path,GTK_ICON_SIZE_BUTTON); + gtk_widget_show(tab->remove_module_button); + gtk_widget_hide(tab->install_module_button); + gtk_widget_show(tab->changelog_button); + gtk_widget_show(tab->launch_button); + + } else tab->module_installed=0; + { + free(check_install_command); + check_install_command = get_package_is_installed_command(tab->package); + if (!system(check_install_command)){ + tab->package_installed=1; + yon_tag_add(GTK_BOX(tab->install_tags_box),PACKAGE_INSTALLED_LABEL,"tag_green",NULL); + gtk_image_set_from_icon_name(GTK_IMAGE(tab->package_icon),package_icon_path,GTK_ICON_SIZE_BUTTON); + gtk_widget_hide(tab->install_package_button); + gtk_widget_show(tab->remove_package_button); + gtk_widget_show(tab->changelog_button); + gtk_widget_show(tab->launch_button); + } + } + yon_char_parsed_free(types_parsed,types_size); + gtk_label_set_markup(GTK_LABEL(tab->name_label),name); + gtk_label_set_markup(GTK_LABEL(tab->module_label),module); + gtk_label_set_markup(GTK_LABEL(tab->package_label),package); + gtk_label_set_text(GTK_LABEL(tab->description_label),parsed[6]); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->KernelSizeGroup),gtk_widget_get_parent(gtk_widget_get_parent(tab->name_label))); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->TagsSizeGroup),tab->tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->InstallSizeGroup),tab->install_tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->RunSizeGroup),tab->run_tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->DescriptionSizeGroup),tab->description_label); + } + + + + return tab; + } + return NULL; +} + +additions_kernels_tab *yon_additions_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets){ + int size; + config_str parsed = yon_char_parse(target_string,&size,";"); + if (size){ + dictionary *cur = yon_dictionary_get(&main_config.addition_tabs,parsed[2]); + additions_kernels_tab *tab = NULL; + if (cur){ + tab = (additions_kernels_tab*)cur->data; + GList *list = gtk_container_get_children(GTK_CONTAINER(tab->install_tags_box)); + for (guint i=0;imodule_installed){ + gtk_widget_show(tab->remove_module_button); + gtk_widget_hide(tab->install_module_button); + gtk_widget_show(tab->remove_module_button); + yon_tag_add(GTK_BOX(tab->install_tags_box),MODULE_INSTALLED_LABEL,"tag_green",NULL); + } else { + gtk_widget_hide(tab->remove_module_button); + gtk_widget_show(tab->install_module_button); + + } + if (tab->package_installed){ gtk_widget_show(tab->remove_package_button); + gtk_widget_hide(tab->install_package_button); + yon_tag_add(GTK_BOX(tab->install_tags_box),PACKAGE_INSTALLED_LABEL,"tag_green",NULL); + + } else { + gtk_widget_hide(tab->remove_package_button); + gtk_widget_show(tab->install_package_button); + + } + } else { + GtkBuilder *builder = gtk_builder_new_from_resource(glade_additions_table_row_path); + + tab = malloc(sizeof(additions_kernels_tab)); + tab->main_box = yon_gtk_builder_get_widget(builder,"TableRowLabel"); + tab->name_label = yon_gtk_builder_get_widget(builder,"NameLabel"); + tab->module_label = yon_gtk_builder_get_widget(builder,"ModuleLabel"); + tab->package_label = yon_gtk_builder_get_widget(builder,"PackageLabel"); + tab->module_icon = yon_gtk_builder_get_widget(builder,"ModuleIcon"); + tab->package_icon = yon_gtk_builder_get_widget(builder,"PackageIcon"); + tab->module_label = yon_gtk_builder_get_widget(builder,"ModuleLabel"); + tab->package_label = yon_gtk_builder_get_widget(builder,"PackageLabel"); + tab->install_tags_box = yon_gtk_builder_get_widget(builder,"InstallTagsBox"); + tab->description_label = yon_gtk_builder_get_widget(builder,"DescriptionLabel"); + tab->remove_module_button = yon_gtk_builder_get_widget(builder,"RemoveModuleButton"); + tab->remove_package_button = yon_gtk_builder_get_widget(builder,"RemovePackageButton"); + tab->install_module_button = yon_gtk_builder_get_widget(builder,"InstallModuleButton"); + tab->install_package_button = yon_gtk_builder_get_widget(builder,"InstallPackageButton"); + + dictionary *dict = NULL; + yon_dictionary_add_or_create_if_exists_with_data(dict,"widgets",widgets); + yon_dictionary_add_or_create_if_exists_with_data(dict,"tab",tab); + g_signal_connect(G_OBJECT(tab->install_module_button),"clicked",G_CALLBACK(on_module_install_clicked),dict); + g_signal_connect(G_OBJECT(tab->install_package_button),"clicked",G_CALLBACK(on_package_install_clicked),dict); + g_signal_connect(G_OBJECT(tab->remove_module_button),"clicked",G_CALLBACK(on_module_remove_clicked),dict); + g_signal_connect(G_OBJECT(tab->remove_package_button),"clicked",G_CALLBACK(on_package_remove_clicked),dict); + gtk_list_box_insert(target,tab->main_box,-1); + + int size; + config_str parsed = yon_char_parse(target_string,&size,";"); + if (size){ + tab->name = yon_char_new(parsed[0]); + tab->module = yon_char_new(parsed[1]); + tab->package = yon_char_new(parsed[2]); + char *name = yon_char_unite("",tab->name,"",NULL); + char *module = yon_char_unite("",MODULE_LABEL," ",tab->module,"",NULL); + char *package = yon_char_unite("",PACKAGE_LABEL," ",tab->package,"",NULL); + char *check_install_command = get_package_is_installed_command(tab->module); + + yon_dictionary_add_or_create_if_exists_with_data(main_config.addition_tabs,tab->package,tab); + + if (!system(check_install_command)){ + yon_tag_add(GTK_BOX(tab->install_tags_box),MODULE_INSTALLED_LABEL,"tag_green",NULL); + + gtk_image_set_from_icon_name(GTK_IMAGE(tab->module_icon),module_icon_path,GTK_ICON_SIZE_BUTTON); + gtk_widget_show(tab->remove_module_button); + gtk_widget_show(tab->remove_package_button); + gtk_widget_hide(tab->install_module_button); + gtk_widget_hide(tab->install_package_button); + } + { + free(check_install_command); + check_install_command = get_package_is_installed_command(tab->package); + if (!system(check_install_command)){ + yon_tag_add(GTK_BOX(tab->install_tags_box),PACKAGE_INSTALLED_LABEL,"tag_green",NULL); + gtk_image_set_from_icon_name(GTK_IMAGE(tab->package_icon),package_icon_path,GTK_ICON_SIZE_BUTTON); + gtk_widget_hide(tab->install_package_button); + gtk_widget_show(tab->remove_package_button); + } + } + gtk_label_set_markup(GTK_LABEL(tab->name_label),name); + gtk_label_set_markup(GTK_LABEL(tab->module_label),module); + gtk_label_set_markup(GTK_LABEL(tab->package_label),package); + gtk_label_set_text(GTK_LABEL(tab->description_label),parsed[3]); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->KernelSizeGroup),gtk_widget_get_parent(gtk_widget_get_parent(tab->name_label))); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->InstallSizeGroup),tab->install_tags_box); + gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->DescriptionSizeGroup),tab->description_label); } } - yon_char_parsed_free(types_parsed,types_size); - gtk_label_set_markup(GTK_LABEL(tab->name_label),name); - gtk_label_set_markup(GTK_LABEL(tab->module_label),module); - gtk_label_set_markup(GTK_LABEL(tab->package_label),package); - gtk_label_set_text(GTK_LABEL(tab->description_label),parsed[6]); - gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->KernelSizeGroup),gtk_widget_get_parent(gtk_widget_get_parent(tab->name_label))); - gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->TagsSizeGroup),tab->tags_box); - gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->InstallSizeGroup),tab->install_tags_box); - gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->RunSizeGroup),tab->run_tags_box); - gtk_size_group_add_widget(GTK_SIZE_GROUP(widgets->DescriptionSizeGroup),tab->description_label); + return tab; } - return tab->main_box; + return NULL; } // standard functions @@ -272,10 +523,18 @@ void config_init(){ main_config.lock_save_global=0; main_config.lock_save_local=0; main_config.load_mode=1; + main_config.save_config=1; + main_config.kernel_tabs=NULL; + main_config.addition_tabs=NULL; } void on_update_clicked(GtkWidget *, main_window *widgets){ - yon_interface_update(widgets); + yon_dictionary_free_all(main_config.kernel_tabs,free); + yon_dictionary_free_all(main_config.addition_tabs,free); + main_config.kernel_tabs=NULL; + main_config.addition_tabs=NULL; + + yon_interface_update(widgets); } void on_selection_changed(GtkWidget *, GtkListBoxRow* row, main_window *widgets){ @@ -434,6 +693,14 @@ void yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->AdditionsPackageBox),"row-selected",G_CALLBACK(on_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->InstallTerminal),"child-exited",G_CALLBACK(on_command_execute_success),widgets); + g_signal_connect(G_OBJECT(widgets->SaveMenuItem),"activate",G_CALLBACK(on_config_save),widgets); + g_signal_connect(G_OBJECT(widgets->SaveGlobalMenuItem),"activate",G_CALLBACK(on_config_global_save),widgets); + g_signal_connect(G_OBJECT(widgets->SaveLocalMenuItem),"activate",G_CALLBACK(on_config_local_save),widgets); + g_signal_connect(G_OBJECT(widgets->SaveCustomMenuItem),"activate",G_CALLBACK(on_config_custom_save),widgets); + g_signal_connect(G_OBJECT(widgets->LoadGlobalMenuItem),"activate",G_CALLBACK(on_config_global_load),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); + GdkRGBA rgba; vte_terminal_get_color_background_for_draw(VTE_TERMINAL(widgets->InstallTerminal),&rgba); vte_terminal_set_color_cursor(VTE_TERMINAL(widgets->InstallTerminal),&rgba); diff --git a/source/ubl-settings-kernel.h b/source/ubl-settings-kernel.h index 65b33e0..2cd641d 100644 --- a/source/ubl-settings-kernel.h +++ b/source/ubl-settings-kernel.h @@ -25,6 +25,7 @@ #define glade_info_path "/com/ublinux/ui/ubl-settings-kernel-info.glade" #define glade_install_path "/com/ublinux/ui/ubl-settings-kernel-install.glade" #define glade_table_row_path "/com/ublinux/ui/ubl-settings-kernel-table-row.glade" +#define glade_additions_table_row_path "/com/ublinux/ui/ubl-settings-kernel-additions-table-row.glade" #define banner_path "/com/ublinux/images/ubl-settings-kernel-banner.png" #define CssPath "/com/ublinux/css/ubl-settings-kernel.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -67,7 +68,10 @@ char *local; typedef struct { template_config_fields - + GMutex mutex; + int save_config; + dictionary *kernel_tabs; + dictionary *addition_tabs; } config; typedef struct { @@ -125,6 +129,11 @@ typedef struct { }install_window; typedef struct { + char *module; + char *package; + char *name; + int module_installed; + int package_installed; GtkWidget *main_box; GtkWidget *name_label; GtkWidget *module_label; @@ -140,16 +149,45 @@ typedef struct { GtkWidget *install_module_button; GtkWidget *install_package_button; GtkWidget *changelog_button; + GtkWidget *launch_button; + +} kernels_tab; + +typedef struct { char *module; char *package; char *name; + int module_installed; + int package_installed; + GtkWidget *main_box; + GtkWidget *name_label; + GtkWidget *module_label; + GtkWidget *package_label; + GtkWidget *module_icon; + GtkWidget *package_icon; + GtkWidget *install_tags_box; + GtkWidget *description_label; + GtkWidget *remove_module_button; + GtkWidget *remove_package_button; + GtkWidget *install_module_button; + GtkWidget *install_package_button; -} kernels_tab; +} additions_kernels_tab; -void yon_interface_update(main_window *widgets); +void *yon_interface_update(main_window *widgets); + + +void on_config_save(GtkWidget *self, main_window *widgets); +void on_config_global_save(GtkWidget *self, main_window *widgets); +void on_config_local_save(GtkWidget *self, main_window *widgets); +void on_config_custom_save(GtkWidget *self, main_window *widgets); void yon_load_proceed(YON_CONFIG_TYPE type); +void on_config_local_load(GtkWidget *, main_window *widgets); +void on_config_global_load(GtkWidget *, main_window *widgets); +void on_config_custom_load(GtkWidget *,main_window *widgets); + void config_init(); void yon_main_window_complete(main_window *widgets); @@ -161,10 +199,12 @@ void on_module_install_clicked(GtkWidget *,dictionary *dict); void on_package_install_clicked(GtkWidget *,dictionary *dict); void on_module_remove_clicked(GtkWidget *,dictionary *dict); void on_package_remove_clicked(GtkWidget *,dictionary *dict); +void on_launch_cliked(GtkWidget *,dictionary *dict); void on_build_execute(GtkWidget *, dictionary *dict); int yon_tag_add(GtkBox *target,char *tag_label, char *tag_style, char *icon_name); -GtkWidget *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets); +kernels_tab *yon_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets); +additions_kernels_tab *yon_additions_tab_row_new(GtkListBox *target, char *target_string, main_window *widgets); void on_update_clicked(GtkWidget *, main_window *widgets); diff --git a/ubl-settings-kernel-additions-table-row.glade b/ubl-settings-kernel-additions-table-row.glade new file mode 100644 index 0000000..ac366be --- /dev/null +++ b/ubl-settings-kernel-additions-table-row.glade @@ -0,0 +1,245 @@ + + + + + + + True + False + 15 + + + True + False + center + vertical + 1 + + + True + False + 5 + + + True + False + + + False + True + 0 + + + + + True + False + Name + True + False + 0 + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + 5 + + + True + False + + + False + True + 0 + + + + + True + False + Module + 0 + + + True + True + 1 + + + + + False + True + 1 + + + + + True + False + 5 + + + True + False + + + False + True + 0 + + + + + True + False + Package + 0 + + + True + True + 1 + + + + + False + True + 2 + + + + + False + True + 1 + + + + + True + False + vertical + + + + + + False + True + 3 + + + + + True + False + center + 5 + vertical + 5 + + + Install module + True + True + True + + + + False + True + 0 + + + + + Remove module + True + True + + + + False + True + 1 + + + + + Install package + True + True + True + + + + False + True + 2 + + + + + Remove package + True + True + + + + False + True + 3 + + + + + False + True + end + 4 + + + + + True + False + True + 0 + + + True + True + end + 6 + + + + + diff --git a/ubl-settings-kernel-table-row.glade b/ubl-settings-kernel-table-row.glade index bfc8643..28bbd33 100644 --- a/ubl-settings-kernel-table-row.glade +++ b/ubl-settings-kernel-table-row.glade @@ -1,5 +1,5 @@ - + @@ -200,9 +200,8 @@ - - Install package - True + + Remove module True True + + + False + True + 5 + + False