|
|
|
|
@ -192,17 +192,21 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
|
|
|
|
|
char *fromint=malloc(5);
|
|
|
|
|
memset(fromint,0,5);
|
|
|
|
|
GError *err=NULL;
|
|
|
|
|
g_key_file_load_from_file(gfile,UserConfigPath,G_KEY_FILE_NONE,&err);
|
|
|
|
|
char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin()));
|
|
|
|
|
sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath);
|
|
|
|
|
g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err);
|
|
|
|
|
if (err){
|
|
|
|
|
struct stat st = {0};
|
|
|
|
|
if (stat("~/.config/ubl-settings-manager/", &st) == -1) {
|
|
|
|
|
mkdir("~/.config/ubl-settings-manager/", 0777);
|
|
|
|
|
char *ptdir=malloc(36+strlen(getlogin()));
|
|
|
|
|
sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager");
|
|
|
|
|
if (stat(ptdir, &st) == -1) {
|
|
|
|
|
mkdir(ptdir, 0777);
|
|
|
|
|
}
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen(UserConfigPath,"w");
|
|
|
|
|
fp=fopen(pth,"w");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
g_key_file_load_from_file(gfile,UserConfigPath,G_KEY_FILE_NONE,&err);
|
|
|
|
|
g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err);
|
|
|
|
|
sprintf(fromint,"%d",main_config.windowPosX);
|
|
|
|
|
g_key_file_set_string(gfile,"window","WindowPosX",fromint);
|
|
|
|
|
sprintf(fromint,"%d",main_config.windowPosY);
|
|
|
|
|
@ -222,7 +226,7 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
|
|
|
|
|
g_key_file_set_string(gfile,"sections",IV->sectionName,IV->categories);
|
|
|
|
|
load_apps_with_clear(IV,widgets->applist,widgets->appssize);
|
|
|
|
|
}
|
|
|
|
|
g_key_file_save_to_file(gfile,UserConfigPath,NULL);
|
|
|
|
|
g_key_file_save_to_file(gfile,pth,NULL);
|
|
|
|
|
gtk_widget_hide(widgets->SettingsWindow);
|
|
|
|
|
//gtk_window_present(GTK_WINDOW(widgets->SettingsWindow));
|
|
|
|
|
};
|
|
|
|
|
@ -852,9 +856,12 @@ int setup_config(){
|
|
|
|
|
main_config.sections->prev=NULL;
|
|
|
|
|
main_config.sections->first=NULL;
|
|
|
|
|
GKeyFile *configfile = g_key_file_new();
|
|
|
|
|
printf("%s\n",UserConfigPath);
|
|
|
|
|
char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin()));
|
|
|
|
|
sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath);
|
|
|
|
|
printf("%s\n",getlogin());
|
|
|
|
|
printf("%s\n",pth);
|
|
|
|
|
printf("%s\n",GlobalConfigPath);
|
|
|
|
|
g_key_file_load_from_file(configfile,UserConfigPath,G_KEY_FILE_KEEP_TRANSLATIONS,&err);
|
|
|
|
|
g_key_file_load_from_file(configfile,pth,G_KEY_FILE_KEEP_TRANSLATIONS,&err);
|
|
|
|
|
if (err){
|
|
|
|
|
g_error_free(err);
|
|
|
|
|
err=NULL;
|
|
|
|
|
|