|
|
|
|
@ -918,7 +918,7 @@ dictionary *yon_scan_desktops(){
|
|
|
|
|
}
|
|
|
|
|
if (apps_dict) return apps_dict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static apps *scanned_application = NULL;
|
|
|
|
|
apps *yon_apps_scan_and_parse_desktops(int *sizef)
|
|
|
|
|
{
|
|
|
|
|
int size = 0;
|
|
|
|
|
@ -941,63 +941,66 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef)
|
|
|
|
|
apps tempapp;
|
|
|
|
|
GKeyFile *gfile = g_key_file_new();
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
|
|
|
|
|
char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err);
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\n", err->message);
|
|
|
|
|
} else {
|
|
|
|
|
if (strcmp(Type, "Application") == 0)
|
|
|
|
|
tempapp.Type = 1;
|
|
|
|
|
else if (strcmp(Type, "pyApplication") == 0)
|
|
|
|
|
tempapp.Type = 2;
|
|
|
|
|
else
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL);
|
|
|
|
|
if (tempapp.Name == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL);
|
|
|
|
|
if (tempapp.Categories == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL);
|
|
|
|
|
if (tempapp.Exec == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL);
|
|
|
|
|
if (tempapp.Icon == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL);
|
|
|
|
|
if (!tempapp.Pluggable)
|
|
|
|
|
tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL);
|
|
|
|
|
if (tempapp.Pluggable)
|
|
|
|
|
tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL);
|
|
|
|
|
if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0)
|
|
|
|
|
if (size == 0)
|
|
|
|
|
{
|
|
|
|
|
applist = (apps *)malloc(size + 1 * sizeof(apps));
|
|
|
|
|
applist[0].filename = yon_char_new(path);
|
|
|
|
|
applist[0].Name = yon_char_new(tempapp.Name);
|
|
|
|
|
applist[0].Categories = yon_char_new(tempapp.Categories);
|
|
|
|
|
applist[0].Exec = yon_char_new(tempapp.Exec);
|
|
|
|
|
applist[0].Icon = yon_char_new(tempapp.Icon);
|
|
|
|
|
applist[0].Type = tempapp.Type;
|
|
|
|
|
applist[0].Pluggable = tempapp.Pluggable;
|
|
|
|
|
applist[0].DualPluggable = tempapp.DualPluggable;
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, &err);
|
|
|
|
|
if (!err){
|
|
|
|
|
char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err);
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\n", err->message);
|
|
|
|
|
} else {
|
|
|
|
|
if (strcmp(Type, "Application") == 0)
|
|
|
|
|
tempapp.Type = 1;
|
|
|
|
|
else if (strcmp(Type, "pyApplication") == 0)
|
|
|
|
|
tempapp.Type = 2;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
applist = (apps *)realloc(applist, (size + 1) * sizeof(apps));
|
|
|
|
|
applist[size].filename = yon_char_new(path);
|
|
|
|
|
applist[size].Name = yon_char_new(tempapp.Name);
|
|
|
|
|
applist[size].Categories = yon_char_new(tempapp.Categories);
|
|
|
|
|
applist[size].Exec = yon_char_new(tempapp.Exec);
|
|
|
|
|
applist[size].Icon = yon_char_new(tempapp.Icon);
|
|
|
|
|
applist[size].Pluggable = tempapp.Pluggable;
|
|
|
|
|
applist[size].DualPluggable = tempapp.DualPluggable;
|
|
|
|
|
applist[size].Type = tempapp.Type;
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL);
|
|
|
|
|
if (tempapp.Name == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL);
|
|
|
|
|
if (tempapp.Categories == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL);
|
|
|
|
|
if (tempapp.Exec == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL);
|
|
|
|
|
if (tempapp.Icon == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL);
|
|
|
|
|
if (!tempapp.Pluggable)
|
|
|
|
|
tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL);
|
|
|
|
|
if (tempapp.Pluggable)
|
|
|
|
|
tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL);
|
|
|
|
|
if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0)
|
|
|
|
|
if (size == 0)
|
|
|
|
|
{
|
|
|
|
|
applist = (apps *)malloc(size + 1 * sizeof(apps));
|
|
|
|
|
applist[0].filename = yon_char_new(path);
|
|
|
|
|
applist[0].Name = yon_char_new(tempapp.Name);
|
|
|
|
|
applist[0].Categories = yon_char_new(tempapp.Categories);
|
|
|
|
|
applist[0].Exec = yon_char_new(tempapp.Exec);
|
|
|
|
|
applist[0].Icon = yon_char_new(tempapp.Icon);
|
|
|
|
|
applist[0].Type = tempapp.Type;
|
|
|
|
|
applist[0].Pluggable = tempapp.Pluggable;
|
|
|
|
|
applist[0].DualPluggable = tempapp.DualPluggable;
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
applist = (apps *)realloc(applist, (size + 1) * sizeof(apps));
|
|
|
|
|
applist[size].filename = yon_char_new(path);
|
|
|
|
|
applist[size].Name = yon_char_new(tempapp.Name);
|
|
|
|
|
applist[size].Categories = yon_char_new(tempapp.Categories);
|
|
|
|
|
applist[size].Exec = yon_char_new(tempapp.Exec);
|
|
|
|
|
applist[size].Icon = yon_char_new(tempapp.Icon);
|
|
|
|
|
applist[size].Pluggable = tempapp.Pluggable;
|
|
|
|
|
applist[size].DualPluggable = tempapp.DualPluggable;
|
|
|
|
|
applist[size].Type = tempapp.Type;
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_key_file_free(gfile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1005,6 +1008,7 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*sizef = size;
|
|
|
|
|
scanned_application = applist;
|
|
|
|
|
return applist;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -1098,7 +1102,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte
|
|
|
|
|
}
|
|
|
|
|
va_end(args);
|
|
|
|
|
int size;
|
|
|
|
|
apps *app_list = yon_apps_scan_and_parse_desktops(&size);
|
|
|
|
|
apps *app_list = scanned_application ? scanned_application : yon_apps_scan_and_parse_desktops(&size);
|
|
|
|
|
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store),&iter);
|
|
|
|
|
for (; valid; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store),&iter)){
|
|
|
|
|
char *cur_categories;
|
|
|
|
|
|