Apps struct update

pull/58/head
parent 1e3180a31a
commit bcad7a0944

@ -19,10 +19,8 @@ int yon_app_set_from_file(apps *target, const char *path){
GKeyFile *cur_file = g_key_file_new();
if (!g_key_file_load_from_file(cur_file,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL)) return 0;
gsize names_size;
config_str names = g_key_file_get_locale_string_list(cur_file,"Desktop Entry","Name",NULL,&names_size,NULL);
target->Name = g_key_file_get_locale_string(cur_file,"Desktop Entry","Name",NULL,NULL);
target->Desktop_path = yon_char_new(path);
target->Name = names[0];
target->Comment = g_key_file_get_string(cur_file,"Desktop Entry","Comment",NULL);
char *categories = g_key_file_get_string(cur_file,"Desktop Entry","Categories",NULL);
target->Categories = yon_char_parse(categories,&target->categories_size,";");
@ -34,6 +32,7 @@ int yon_app_set_from_file(apps *target, const char *path){
target->DualPluggable = !yon_char_is_empty(dual_pluggable)&&!strcmp(dual_pluggable,"true");
char *type = g_key_file_get_string(cur_file,"Desktop Entry","Type",NULL);
target->Type = !yon_char_is_empty(type)&&!strcmp(type,"Application");
target->keywords = g_key_file_get_locale_string(cur_file,"Desktop Entry","Keywords",NULL,NULL);
if (!yon_char_is_empty(target->Exec)){
int parsed_size;
@ -66,7 +65,7 @@ void yon_apps_init(){
char *cur_path = yon_char_unite(DesktopPath,"/",paths[i],NULL);
apps *cur_app = yon_app_new();
yon_app_set_from_file(cur_app,cur_path);
g_hash_table_insert(_apps,yon_char_new(cur_app->Name),cur_app);
g_hash_table_insert(_apps,yon_char_new(cur_app->Desktop_path),cur_app);
}
}
@ -99,7 +98,7 @@ config_str yon_apps_get_by_categories(config_str categories, int categories_size
for (iter=list;iter;iter=iter->next){
apps *cur_app = (apps*)iter->data;
if (yon_char_parsed_includes_char_parsed(cur_app->Categories,categories,cur_app->categories_size, categories_size)){
yon_char_parsed_add_or_create_if_exists(final,final_size,cur_app->Name);
yon_char_parsed_add_or_create_if_exists(final,final_size,cur_app->Desktop_path);
}
}
return final;

@ -629,6 +629,7 @@ typedef struct apps
char *Icon;
int Pluggable;
int DualPluggable;
char *keywords;
} apps;
/// @brief Initiallize applications system

Loading…
Cancel
Save