diff --git a/source/ubinstall-gtk-components.c b/source/ubinstall-gtk-components.c index f3aa8ff..5014639 100644 --- a/source/ubinstall-gtk-components.c +++ b/source/ubinstall-gtk-components.c @@ -10,13 +10,18 @@ int yon_kernel_save(main_window *widgets){ char *temp = yon_char_unite(install_modules,!yon_char_is_empty(install_modules)?" ":"",row->modules,NULL); if (!yon_char_is_empty(install_modules)) free(install_modules); install_modules = temp; - } - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->EnableRadio))){ - enabled_module = row->package; + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(row->EnableRadio))){ + enabled_module = row->package; + } } } + if (!yon_char_is_empty(install_modules)){ + yon_config_register(modules_extra_parameter,modules_extra_parameter_command,install_modules); + } else { + yon_config_remove_by_key(modules_extra_parameter); + } yon_config_register(KERNEL_BOOT_parameter,KERNEL_BOOT_parameter_command,enabled_module); return 1; @@ -68,7 +73,22 @@ int yon_software_save(main_window *widgets){ return 1; } -int yon_pacman_software_save(main_window *){ - +int yon_pacman_software_save(main_window *widgets){ + GtkTreeIter iter; + GtkTreeModel *model = GTK_TREE_MODEL(widgets->PacmanSoftwareChosenList); + int size; + config_str parameters = NULL; + for_iter(model,&iter){ + char *target; + gtk_tree_model_get(model,&iter,1,&target,-1); + yon_char_parsed_add_or_create_if_exists(parameters,&size,target); + } + char *final = yon_char_parsed_to_string(parameters,size,","); + yon_char_parsed_free(parameters,size); + if (!yon_char_is_empty(final)){ + yon_config_register(packages_parameter,packages_parameter_command,final); + } else { + yon_config_remove_by_key(packages_parameter); + } return 1; } \ No newline at end of file diff --git a/source/ubinstall-gtk-page-switch.c b/source/ubinstall-gtk-page-switch.c index 6df3698..780750e 100644 --- a/source/ubinstall-gtk-page-switch.c +++ b/source/ubinstall-gtk-page-switch.c @@ -12,8 +12,8 @@ enum YON_PAGES yon_page_get_next(main_window *widgets, enum YON_PAGES page){ case YON_PAGE_INSTALLATION_BEGIN: return YON_PAGE_KERNEL; break; case YON_PAGE_KERNEL: return YON_PAGE_KERNEL_ADDON; break; case YON_PAGE_KERNEL_ADDON: return YON_PAGE_PACMAN_SOFTWARE; break; - case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_SOFTWARE; - case YON_PAGE_SOFTWARE: return YON_PAGE_REGION; break; + case YON_PAGE_PACMAN_SOFTWARE: return YON_PAGE_REGION; + case YON_PAGE_SOFTWARE: return YON_PAGE_PACMAN_SOFTWARE; break; case YON_PAGE_REGION: return YON_PAGE_KEYBOARD; break; case YON_PAGE_KEYBOARD: return YON_PAGE_USERS; break; case YON_PAGE_USERS: return YON_PAGE_STARTUP; break; diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 6d3b1a4..89efdb4 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -22,6 +22,7 @@ void on_pacman_software_all_toggled(GtkWidget *, char *path, main_window *widget gtk_list_store_remove(widgets->PacmanSoftwareAllList,&iter); gtk_list_store_append(widgets->PacmanSoftwareChosenList,&iter); gtk_list_store_set(widgets->PacmanSoftwareChosenList,&iter,0,1,1,name,2,type,3,description,-1); + g_hash_table_add(widgets->pacmanchosen,yon_char_new(name)); } @@ -33,7 +34,7 @@ void on_pacman_software_chosen_toggled(GtkWidget *, char *path, main_window *wid gtk_list_store_remove(widgets->PacmanSoftwareChosenList,&iter); gtk_list_store_append(widgets->PacmanSoftwareAllList,&iter); gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,name,2,type,3,description,-1); - + g_hash_table_remove(widgets->pacmanchosen,name); } gboolean yon_pacman_fill(struct pacman_struct *pacman){ @@ -43,14 +44,14 @@ gboolean yon_pacman_fill(struct pacman_struct *pacman){ for (int i=0;ipacmanchosen,loaded[i])) continue; + char *version = yon_packages_get_version(YON_PACKAGES_SYNC,loaded[i]); + char *description = yon_packages_get_description(YON_PACKAGES_SYNC,loaded[i]); GtkTreeIter iter; gtk_list_store_append(widgets->PacmanSoftwareAllList,&iter); - gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,parsed[0],2,parsed[1],3,parsed[2],-1); - yon_char_parsed_free(parsed,parsed_size); + gtk_list_store_set(widgets->PacmanSoftwareAllList,&iter,0,0,1,loaded[i],2,version,3,description,-1); + if (!yon_char_is_empty(version))free(version); + if (!yon_char_is_empty(description)) free(description); } yon_char_parsed_free(loaded,size); gtk_widget_set_sensitive(widgets->PacmanSoftwareSearchEntry,1); @@ -63,8 +64,8 @@ gboolean yon_pacman_fill(struct pacman_struct *pacman){ void *yon_pacman_load(struct pacman_struct *pacman){ const char *find_package = pacman->find_package; - char *command = get_local_module_info_command(find_package); - pacman->packages = yon_config_load(yon_debug_output("%s\n",command),&pacman->packages_size); + // char *command = get_local_module_info_command(find_package); + pacman->packages = yon_packages_find(YON_PACKAGES_SYNC,find_package,&pacman->packages_size); g_idle_add((GSourceFunc)yon_pacman_fill,pacman); return NULL; } @@ -150,6 +151,7 @@ void config_init(){ main_config.log_progress_buzy=0; main_config.log_end=0; main_config.exit_accepted=0; + yon_packages_init(); } // void on_root_get_root(char *argline){ @@ -507,6 +509,7 @@ main_window *yon_main_window_complete(){ widgets->HostnameSensitiveCheck = yon_gtk_builder_get_widget(builder,"HostnameSensitiveCheck"); widgets->AutoHostnameCheck=yon_gtk_builder_get_widget(builder,"AutoHostnameCheck"); widgets->network_connections = NULL; + widgets->pacmanchosen = g_hash_table_new_full(g_str_hash,g_str_equal,free,NULL); main_config.status_box = widgets->StatusBox; } @@ -747,16 +750,20 @@ main_window *yon_main_window_complete(){ int base_size; config_str base = yon_file_ls(system_base_modules_path,&base_size); for (int i=0;iOSSoftwareList,&iter); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],-1); + gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,base[i],2,version,3,description,-1); } int modules_size; config_str modules = yon_file_ls(system_modules_path,&modules_size); for (int i=0;iOSSoftwareList,&iter); - gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],-1); + char *version = yon_packages_get_version(YON_PACKAGES_SYNC,base[i]); + char *description = yon_packages_get_description(YON_PACKAGES_SYNC,base[i]); + gtk_list_store_set(widgets->OSSoftwareList,&iter,0,0,1,modules[i],2,version,3,description,-1); } } diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 738c472..267bf9c 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -152,6 +152,8 @@ NULL #define swap_size_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[swap_size]" #define boot_parameter "AUTOINSTALL[boot]" #define boot_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[boot]" +#define packages_parameter "AUTOINSTALL[packages]" +#define packages_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[packages]" #define device_typevfs_parameter "AUTOINSTALL[device_typevfs]" #define device_typevfs_parameter_command "ubconfig --source global get [autoinstall] AUTOINSTALL[device_typevfs]" #define NTPSERVERS_parameter "AOUTINSTALL[ubconfig set [network] NTPSERVERS]" @@ -533,6 +535,7 @@ typedef struct { GtkWidget *PacmanSoftwareAllPackagesTree; GtkListStore *PacmanSoftwareAllList; GtkCellRenderer *PacmanSoftwareAllCell; + GHashTable *pacmanchosen; GtkWidget *PacmanSoftwareChosenPackagesTree; GtkListStore *PacmanSoftwareChosenList; @@ -586,6 +589,7 @@ typedef struct { GFileMonitor *install_progress_monitor; GFile *install_info_file; GFileMonitor *install_info_monitor; + } main_window; typedef struct { @@ -755,7 +759,7 @@ typedef struct { struct pacman_struct{ main_window *widgets; const char *find_package; - int packages_size; + gsize packages_size; config_str packages; };