diff --git a/source/ubl-settings-kernel.c b/source/ubl-settings-kernel.c index 6dff6ad..4283893 100644 --- a/source/ubl-settings-kernel.c +++ b/source/ubl-settings-kernel.c @@ -254,7 +254,7 @@ void *yon_command_execute_async(char *command,main_window *widgets){ return NULL; } -void on_install_accept(GtkWidget *, dictionary *dict){ +void on_module_install_accept(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*); dialog_window *window = yon_dictionary_get_data(dict->first->next->next,dialog_window*); @@ -279,6 +279,31 @@ void on_install_accept(GtkWidget *, dictionary *dict){ on_subwindow_close(window->Window); } +void on_package_install_accept(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*); + dialog_window *window = yon_dictionary_get_data(dict->first->next->next,dialog_window*); + char *modules_to_install = tab->package; + + GtkTreeIter iter; + for_iter (GTK_TREE_MODEL(window->liststore1),&iter){ + int status; + char *package; + gtk_tree_model_get(GTK_TREE_MODEL(window->liststore1),&iter,0,&status,1,&package,-1); + if (status){ + char *temp = yon_char_unite(modules_to_install," ", package, NULL); + if (strcmp(modules_to_install,tab->module)) free(modules_to_install); + modules_to_install = temp; + } + } + char *command = install_command(modules_to_install); + yon_command_execute_async(command,widgets); + tab->package_installed=1; + free(dict->first->next->next); + dict->first->next->next=NULL; + on_subwindow_close(window->Window); +} + dialog_window *yon_dialog_window_new(){ GtkBuilder *builder = gtk_builder_new_from_resource(glade_dialog_path); dialog_window *window = malloc(sizeof(dialog_window)); @@ -301,7 +326,7 @@ void on_module_install_clicked(GtkWidget *self,dictionary *dict){ char *action_text = MODULE_INSTALL_CONFIRMATION_LABEL(tab->name); if (!gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))){ dialog_window *window = yon_dialog_window_new(); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_install_accept),dict); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_module_install_accept),dict); gtk_label_set_text(GTK_LABEL(window->TopicLabel),action_text); gtk_widget_show(window->Window); @@ -330,7 +355,7 @@ void on_module_install_clicked(GtkWidget *self,dictionary *dict){ if (yon_confirmation_dialog_call(self,data) == GTK_RESPONSE_ACCEPT){ char *command = install_command(tab->module); yon_command_execute_async(command,widgets); - tab->module_installed=0; + tab->module_installed=1; } } } @@ -341,7 +366,7 @@ void on_package_install_clicked(GtkWidget *self,dictionary *dict){ char *action_text = MODULE_INSTALL_CONFIRMATION_LABEL(tab->name); if (!gtk_notebook_get_current_page(GTK_NOTEBOOK(widgets->MainNotebook))){ dialog_window *window = yon_dialog_window_new(); - g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_install_accept),dict); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_package_install_accept),dict); gtk_label_set_text(GTK_LABEL(window->TopicLabel),action_text); gtk_widget_show(window->Window); @@ -371,7 +396,7 @@ void on_package_install_clicked(GtkWidget *self,dictionary *dict){ if (yon_confirmation_dialog_call(self,data) == GTK_RESPONSE_ACCEPT){ char *command = install_command(tab->package); yon_command_execute_async(command,widgets); - tab->module_installed=0; + tab->package_installed=1; } } } @@ -555,7 +580,7 @@ kernels_tab *yon_tab_row_new(GtkListBox *target, char *target_string, main_windo gtk_widget_show(tab->remove_package_button); gtk_widget_show(tab->changelog_button); gtk_widget_show(tab->launch_button); - } + } else tab->package_installed=0; } yon_char_parsed_free(types_parsed,types_size); gtk_label_set_markup(GTK_LABEL(tab->name_label),name); @@ -664,7 +689,7 @@ additions_kernels_tab *yon_additions_tab_row_new(GtkListBox *target, char *targe gtk_widget_show(tab->remove_package_button); gtk_widget_hide(tab->install_module_button); gtk_widget_hide(tab->install_package_button); - } + } else tab->module_installed=0; { free(check_install_command); check_install_command = get_package_is_installed_command(tab->package); @@ -674,7 +699,7 @@ additions_kernels_tab *yon_additions_tab_row_new(GtkListBox *target, char *targe 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); - } + } else tab->package_installed=0; } gtk_label_set_markup(GTK_LABEL(tab->name_label),name); gtk_label_set_markup(GTK_LABEL(tab->module_label),module); diff --git a/source/ubl-settings-kernel.h b/source/ubl-settings-kernel.h index 94b520c..710a72b 100644 --- a/source/ubl-settings-kernel.h +++ b/source/ubl-settings-kernel.h @@ -220,7 +220,8 @@ void *yon_command_execute_async(char *command,main_window *widgets); dialog_window *yon_dialog_window_new(); -void on_install_accept(GtkWidget *, dictionary *dict); +void on_module_install_accept(GtkWidget *, dictionary *dict); +void on_package_install_accept(GtkWidget *, dictionary *dict); void on_module_install_clicked(GtkWidget *,dictionary *dict); void on_package_install_clicked(GtkWidget *,dictionary *dict);