diff --git a/Makefile b/Makefile index 7773d59..3c52f42 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ init: version="$$(cat VERSION.md)"; \ version=$${version:8}; \ search="s/string version_application.*"; \ - echo $$search; \ replace="string version_application = \"$${version}\";"; \ sed -i -e "$$search/$$replace/gi" source/ubl-settings-manager.h; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" @@ -84,9 +83,7 @@ uninstall: done @$(RM) "/usr/bin/${PKGNAME}" @$(RM) "/usr/share/applications/${PKGNAME}.desktop" - @$(RM) "/usr/share/icons/hicolor/scalable/apps/${PKGNAME}.png" @$(RM) "/usr/share/icons/hicolor/scalable/apps/${PKGNAME}.svg" - @$(RM) "/usr/share/icons/hicolor/scalable/apps/ubl-settings-manager.svg" @$(RM) "/usr/share/${PKGNAME}/ui/ublinux-logo.svg" @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}.glade" @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" @@ -95,7 +92,7 @@ uninstall: @$(RM) -d "/usr/share/${PKGNAME}/css" @$(RM) -d "/usr/share/${PKGNAME}/ui" @$(RM) -d "/usr/share/${PKGNAME}" - @$(RM) "/etc/ubconfig-main.conf" + @$(RM) "/etc/xdg/${PKGNAME}/${PKGNAME}.conf" @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null @update-desktop-database --quiet 2>/dev/null @touch /usr/share/applications @@ -124,8 +121,7 @@ install: check uninstall @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.glade @install -Dm644 -t /usr/share/${PKGNAME}/css/ ${PKGNAME}.css @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ublinux-logo.svg - @install -Dm644 -t /etc/ ubconfig-main.conf - @chmod 766 /etc/ubconfig-main.conf + @install -Dm766 -t /etc/xdg/${PKGNAME}/ ${PKGNAME}.conf @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}-banner.png @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null @update-desktop-database --quiet 2>/dev/null diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index b91028a..53291bd 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -877,27 +877,28 @@ apps *find_apps(int *sizef){ 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 (size==0){ - applist=(apps*)malloc(size+1*sizeof(apps)); - 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].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++; - } + if (g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBL-SettingsManager-Hidden",NULL)==1) + if (size==0){ + applist=(apps*)malloc(size+1*sizeof(apps)); + 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].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++; + } } } } @@ -946,11 +947,7 @@ int check_categories(apps app, char *catstocheck){ int setup_config(){ FILE *file; GError *err=NULL; - main_config.sections=malloc(sizeof(dictionary)); - main_config.sections->data=NULL; - main_config.sections->next=NULL; - main_config.sections->prev=NULL; - main_config.sections->first=NULL; + main_config.sections=yon_dictionary_create_empty(); GKeyFile *configfile = g_key_file_new(); char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); @@ -997,7 +994,7 @@ int setup_config(){ gsize length=0; char **a=g_key_file_get_keys(configfile,"sections",&length,NULL); - if (!a){yon_set_default_sections(&main_config.sections);} else { + if (!a){yon_set_default_sections(main_config.sections);} else { for (int i=0;isection="Personal"; - sec->categories="X-UBL-SettingsManager;X-UBL-PersonalSettings;"; - (*section)->data=sec; - (*section)->first=*section; - (*section)->next=malloc(sizeof(dictionary)); - (*section)->next->prev=*section; - (*section)->next->first=(*section)->first; - *section=(*section)->next; - sec=malloc(sizeof(IconSection)); - sec->section="Hardware"; - sec->categories="X-UBL-SettingsManager;X-UBL-HardwareSettings;"; - (*section)->data=sec; - (*section)->next=malloc(sizeof(dictionary)); - (*section)->next->prev=*section; - (*section)->next->first=(*section)->first; - *section=(*section)->next; - sec=malloc(sizeof(IconSection)); - sec->section="System"; - sec->categories="X-UBL-SettingsManager;X-UBL-SystemSettings;"; - (*section)->data=sec; - (*section)->next=malloc(sizeof(dictionary)); - (*section)->next->prev=*section; - (*section)->next->first=(*section)->first; - *section=(*section)->next; - sec=malloc(sizeof(IconSection)); - sec->section="Misc"; - sec->categories="X-UBL-SettingsManager;"; - (*section)->data=sec; - *section=(*section)->first; +void yon_set_default_sections(dictionary *section){ + yon_section_new(section,"Personal","X-UBL-SettingsManager;X-UBL-PersonalSettings;"); + section=yon_dictionary_create_conneced(section); + yon_section_new(section,"Hardware","X-UBL-SettingsManager;X-UBL-HardwareSettings;"); + section=yon_dictionary_create_conneced(section); + yon_section_new(section,"System","X-UBL-SettingsManager;X-UBL-SystemSettings;"); + section=yon_dictionary_create_conneced(section); + yon_section_new(section,"Misc","X-UBL-SettingsManager;X-UBL-MiscSettings;"); } IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ @@ -1230,7 +1203,7 @@ void yon_check_path(char *path){ dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ section->next=NULL; IconSection *sct=malloc(sizeof(IconSection)); - dictionary *dict=malloc(sizeof(dictionary)); + dictionary *dict=yon_dictionary_create_empty();//malloc(sizeof(dictionary)); sct->section=section_name; sct->categories=categories; dict->data=sct; diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index df806b5..85ee5c5 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -7,8 +7,8 @@ #define GladePath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager.glade" #define CssPath "/usr/share/ubl-settings-manager/css/ubl-settings-manager.css" -#define GlobalConfigPath "/etc/ubconfig-main.conf" -#define UserConfigPath "/.config/ubl-settings-manager/ubconfig-main.conf" +#define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf" +#define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf" #define AppIconPath "ubl-settings-manager" #define AppBannerPath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager-banner.png" #define DesktopPath "/usr/share/applications/" @@ -202,7 +202,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them char *yon_char_get_augumented(char *source, char *append); char *yon_cut(char *source, int size, int startpos); int yon_set_sections(IconSection *section); -void yon_set_default_sections(dictionary **section); +void yon_set_default_sections(dictionary *section); char *yon_char_divide_search(char *source, char* dividepos, int delete_divider); char *yon_char_divide(char *source, int dividepos); dictionary *yon_section_new(dictionary *section, char *section_name, char *categories); diff --git a/ubconfig-main.conf b/ubl-settings-manager.conf similarity index 100% rename from ubconfig-main.conf rename to ubl-settings-manager.conf