pull/59/head
parent bcad7a0944
commit 1f98c56a55

@ -17,7 +17,11 @@ void yon_app_free(apps *target){
int yon_app_set_from_file(apps *target, const char *path){ int yon_app_set_from_file(apps *target, const char *path){
GKeyFile *cur_file = g_key_file_new(); 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; GError *err = NULL;
if (!g_key_file_load_from_file(cur_file,path,G_KEY_FILE_KEEP_TRANSLATIONS,&err)) {
printf("%s\n",err->message);
return 0;
}
target->Name = g_key_file_get_locale_string(cur_file,"Desktop Entry","Name",NULL,NULL); target->Name = g_key_file_get_locale_string(cur_file,"Desktop Entry","Name",NULL,NULL);
target->Desktop_path = yon_char_new(path); target->Desktop_path = yon_char_new(path);
@ -64,9 +68,10 @@ void yon_apps_init(){
if (!strstr(paths[i],".desktop")) continue; if (!strstr(paths[i],".desktop")) continue;
char *cur_path = yon_char_unite(DesktopPath,"/",paths[i],NULL); char *cur_path = yon_char_unite(DesktopPath,"/",paths[i],NULL);
apps *cur_app = yon_app_new(); apps *cur_app = yon_app_new();
yon_app_set_from_file(cur_app,cur_path); if (yon_app_set_from_file(cur_app,cur_path)){
g_hash_table_insert(_apps,yon_char_new(cur_app->Desktop_path),cur_app); g_hash_table_insert(_apps,yon_char_new(cur_app->Desktop_path),cur_app);
} }
}
} }
gboolean __yon_apps_uninit_remove(char *key, apps *value, void*){ gboolean __yon_apps_uninit_remove(char *key, apps *value, void*){

Loading…
Cancel
Save