Added new functions

pull/66/head
parent 333817248b
commit 801bb3c0b7

@ -199,6 +199,27 @@ char* yon_alpm_list_to_char(alpm_list_t *list){
return final;
}
void yon_packages_info_struct_free(yon_packages_info *info){
if (!yon_char_is_empty(info->repo_name)) free(info->repo_name);
if (!yon_char_is_empty(info->package_name)) free(info->package_name);
if (!yon_char_is_empty(info->version)) free(info->version);
if (!yon_char_is_empty(info->description)) free(info->description);
if (!yon_char_is_empty(info->architecture)) free(info->architecture);
if (!yon_char_is_empty(info->url)) free(info->url);
if (!yon_char_is_empty(info->licence)) free(info->licence);
if (!yon_char_is_empty(info->groups)) free(info->groups);
if (!yon_char_is_empty(info->provides)) free(info->provides);
if (!yon_char_is_empty(info->depends)) free(info->depends);
if (!yon_char_is_empty(info->optional_depends)) free(info->optional_depends);
if (!yon_char_is_empty(info->conflicts)) free(info->conflicts);
if (!yon_char_is_empty(info->replaces)) free(info->replaces);
if (!yon_char_is_empty(info->download_size)) free(info->download_size);
if (!yon_char_is_empty(info->install_size)) free(info->install_size);
if (!yon_char_is_empty(info->packager)) free(info->packager);
if (!yon_char_is_empty(info->build_date)) free(info->build_date);
free(info);
}
yon_packages_info *yon_packages_get_info_struct(enum YON_PACKAGES_DB_TYPE type, const char *package){
if (yon_char_is_empty(package)) return NULL;
@ -406,6 +427,27 @@ GList *yon_packages_get_all(){
return list;
}
GList *yon_packages_search_all(char *pkgname_regex){
if (!packages_struct.init_status) return NULL;
GList *list = NULL;
alpm_list_t *sync_db = alpm_get_syncdbs(packages_struct.packages_handle);
for (alpm_list_t *iter=sync_db;iter;iter=alpm_list_next(iter)){
alpm_db_t *database = iter->data;
alpm_list_t *package_list = alpm_db_get_pkgcache(database);
for (alpm_list_t *iter = package_list;iter;iter=iter->next){
const char *cur_name = alpm_pkg_get_name(iter->data);
if (g_regex_match_simple(pkgname_regex,cur_name,0,0)){
if (!list) list = g_list_append(list,yon_char_new(cur_name));
else if (g_list_append(list,yon_char_new(cur_name))){};
}
}
}
return list;
}
int yon_packages_upac_init(){
}

@ -582,6 +582,7 @@ int yon_packages_check_installed(char *package);
int yon_packages_check_updates(char *package);
void yon_packages_finish();
GList *yon_packages_get_all();
GList *yon_packages_search_all(char *pkgname_regex);
void yon_packages_update();
int yon_packages_install(char *package);
int yon_packages_remove(char *package);
@ -616,6 +617,7 @@ typedef struct {
yon_packages_info *yon_packages_get_info_struct(enum YON_PACKAGES_DB_TYPE type, const char *package);
void yon_packages_info_struct_free(yon_packages_info *info);
char *yon_packages_get_info_string(yon_packages_info *info);
void yon_combo_box_set_default(GtkComboBoxText *target, char *command, char*(result_callback)(char*));

Loading…
Cancel
Save