|
|
|
|
@ -876,6 +876,46 @@ config_str yon_ubl_get_all_slices(int *slices_size){
|
|
|
|
|
|
|
|
|
|
// parsing functions
|
|
|
|
|
|
|
|
|
|
dictionary *yon_scan_desktops(){
|
|
|
|
|
dictionary *apps_dict = NULL;
|
|
|
|
|
DIR *directory = opendir(DesktopPath);
|
|
|
|
|
struct dirent *de;
|
|
|
|
|
while ((de = readdir(directory)))
|
|
|
|
|
{
|
|
|
|
|
FILE *file;
|
|
|
|
|
char *path = yon_char_append(DesktopPath, de->d_name);
|
|
|
|
|
file = fopen(path, "r");
|
|
|
|
|
if (strstr(path,".desktop")){
|
|
|
|
|
apps *application = malloc(sizeof(apps));
|
|
|
|
|
GKeyFile *gfile = g_key_file_new();
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
if (!access(path,F_OK)){
|
|
|
|
|
g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
|
|
|
|
|
application->Type = !strcmp(g_key_file_get_string(gfile, "Desktop Entry", "Type", &err),"Application") ? 1 : 0;
|
|
|
|
|
if (application->Type){
|
|
|
|
|
application->Name = g_key_file_get_locale_string(gfile,"Desktop Entry", "Name",setlocale(LC_ALL, NULL),&err);
|
|
|
|
|
application->Categories = g_key_file_get_string(gfile,"Desktop Entry", "Categories",&err);
|
|
|
|
|
application->Exec = g_key_file_get_string(gfile,"Desktop Entry", "Exec",&err);
|
|
|
|
|
application->Icon = g_key_file_get_string(gfile,"Desktop Entry", "Icon",&err);
|
|
|
|
|
application->Pluggable = (g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL)||
|
|
|
|
|
g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",&err));
|
|
|
|
|
application->DualPluggable = g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL);
|
|
|
|
|
application->Hidden = g_key_file_get_boolean(gfile,"Desktop Entry", "X-X-UBL-SettingsManager-Hidden",NULL);
|
|
|
|
|
if (application->Name&&application->Exec){
|
|
|
|
|
if (!apps_dict){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(apps_dict,application->Name,application);
|
|
|
|
|
} else if (!yon_dictionary_get(&apps_dict,application->Name)){
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(apps_dict,application->Name,application);
|
|
|
|
|
} else {
|
|
|
|
|
yon_dictionary_set_data(apps_dict,application);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (apps_dict) return apps_dict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apps *yon_apps_scan_and_parse_desktops(int *sizef)
|
|
|
|
|
{
|
|
|
|
|
@ -956,6 +996,7 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef)
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_key_file_free(gfile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1004,6 +1045,9 @@ void __yon_on_app_chooser_selection(GtkTreeView *self, GtkTreeStore *store){
|
|
|
|
|
if (gtk_tree_model_iter_nth_child(model,&parentiter,&iter,0))
|
|
|
|
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(self),&parentiter);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
gtk_tree_model_get_iter_first(model,&iter);
|
|
|
|
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(self),&iter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1027,7 +1071,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte
|
|
|
|
|
g_object_ref(box);
|
|
|
|
|
gtk_container_remove(GTK_CONTAINER(window),box);
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5);
|
|
|
|
|
(gtk_dialog_get_content_area(GTK_DIALOG(dialog)),0);
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),"workingbg");
|
|
|
|
|
GtkWidget *main_tree = GTK_WIDGET(gtk_builder_get_object(builder,"MainTree"));
|
|
|
|
|
GtkTreeStore *store = GTK_TREE_STORE(gtk_builder_get_object(builder,"treestore1"));
|
|
|
|
|
va_list args;
|
|
|
|
|
|