Updates for new libraries version

pull/30/head
parent 13ddd99b47
commit f638149592

@ -5,11 +5,13 @@ config main_config;
//functions
void yon_load_proceed(YON_CONFIG_TYPE type){
if (yon_config_load_register(type,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL)){}
else{
textdomain(template_ui_LocaleName);
yon_ubl_status_box_render(LOAD_FAILED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
textdomain(LocaleName);
yon_config_clean();
yon_config_load_config(YON_CONFIG_DEFAULT,config_get_default_command,NULL);
if (type==YON_CONFIG_GLOBAL){
yon_config_load_config(type,config_get_global_command,NULL);
}
if (type==YON_CONFIG_LOCAL){
yon_config_load_config(type,config_get_local_command,NULL);
}
}
@ -164,13 +166,11 @@ void yon_config_global_load(GtkWidget *self, main_window *widgets){
void yon_config_global_local_save(){
int changed = yon_config_get_status(id_parameter)==1;
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL);
template_saving_window *window = yon_save_proceed(NULL,YON_CONFIG_BOTH,config_get_global_command,NULL);
if (window){
if (changed){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"warning",SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
} else {
yon_ubl_status_box_render(SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
// yon_ubl_status_box_render(yon_char_unite(SAVE_SUCCESS,"\n", SAVE_WARNING_LABEL,NULL),BACKGROUND_IMAGE_SUCCESS_TYPE);
@ -178,26 +178,22 @@ void yon_config_global_local_save(){
void yon_config_local_save(){
int changed = yon_config_get_status(id_parameter)==1;
template_saving_window *window = yon_save_proceed("system",YON_CONFIG_LOCAL,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL);
template_saving_window *window = yon_save_proceed("system",YON_CONFIG_LOCAL,config_get_local_command,NULL);
if (window){
if (changed){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"warning",SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
} else {
yon_ubl_status_box_render(SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
}
void yon_config_global_save(){
int changed = yon_config_get_status(id_parameter)==1;
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,hostname_section,hostname_parameter,id_section,id_parameter,console_font_section,console_font_parameter,locale_section,locale_parameter,language_section,language_parameter,NULL);
template_saving_window *window = yon_save_proceed("global",YON_CONFIG_GLOBAL,config_get_global_command,NULL);
if (window){
if (changed){
yon_ubl_status_box_spawn_infinite(GTK_CONTAINER(window->StatusBox),"warning",SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
} else {
yon_ubl_status_box_render(SAVE_WARNING_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
@ -230,7 +226,7 @@ void on_locale_accept(GtkWidget *self, dictionary *dict){
}
gtk_entry_set_text(GTK_ENTRY(widgets->LocaleEntry),final_string);
if (yon_config_get_by_key("LOCALE")) yon_config_set("LOCALE",final_ids);
else yon_config_register("LOCALE",locale_section,final_ids);
else yon_config_register("LOCALE",LOCALE_get_command,final_ids);
on_subwindow_close(self);
}
@ -260,7 +256,7 @@ void on_hostname_changed(GtkEntry *self, main_window *widgets){
if (yon_config_get_by_key(hostname_parameter)){
yon_config_set(hostname_parameter,text);
} else {
yon_config_register(hostname_parameter,hostname_section,text);
yon_config_register(hostname_parameter,HOSTNAME_get_command,text);
}
}
@ -270,7 +266,7 @@ void on_id_combo_toggled(GtkComboBox *self, main_window *widgets){
if (yon_config_get_by_key(id_parameter)){
yon_config_set(id_parameter, id == 1 ? "random" : "hardware");
} else {
yon_config_register(id_parameter,id_section, id == 1 ? "random":"hardware");
yon_config_register(id_parameter,MACHINEID_get_command, id == 1 ? "random":"hardware");
}
}
if (id<3){
@ -287,7 +283,7 @@ void on_id_changed(GtkEntry *self, main_window *widgets){
if (yon_config_get_by_key(id_parameter)){
yon_config_set(id_parameter,text);
} else {
yon_config_register(id_parameter,id_section,text);
yon_config_register(id_parameter,MACHINEID_get_command,text);
}
if (!main_config.lock_save_global)
gtk_widget_set_sensitive(widgets->SaveGlobalMenuItem,1);
@ -326,7 +322,7 @@ void on_console_font_changed(GtkComboBox *self, main_window *widgets){
if (yon_config_get_by_key(console_font_parameter)){
yon_config_set(console_font_parameter,code);
} else {
yon_config_register(console_font_parameter,console_font_section,code);
yon_config_register(console_font_parameter,CONSOLE_FONT_get_command,code);
}
}
}
@ -340,7 +336,7 @@ void on_language_changed(GtkComboBox *self, main_window *widgets){
if (yon_config_get_by_key(language_parameter)){
yon_config_set(language_parameter,code);
} else {
yon_config_register(language_parameter,language_section,code);
yon_config_register(language_parameter,LANG_get_command,code);
}
}

@ -37,20 +37,27 @@
#define get_id_command "grep '' /etc/machine-id"
// #define get_fonts_command "ls /usr/share/kbd/consolefonts/ |grep -v \"README\"|grep -oE \"^[-a-zA-Z0-9_]{3,}.psf\"|sed -e 's/\\.psf//g'"
#define config_get_local_command "ubconfig --source system get system HOSTNAME MACHINEID", "ubconfig --source system get locale CONSOLE_FONT LOCALE LANG"
#define config_get_global_command "ubconfig --source global get system HOSTNAME MACHINEID", "ubconfig --source global get locale CONSOLE_FONT LOCALE LANG"
#define config_get_default_command "ubconfig --source default get "
#define config_get_global_only_parameters ""
#define config_get_local_only_parameters ""
#define hostname_parameter "HOSTNAME"
#define hostname_section "system"
#define id_parameter "MACHINEID"
#define id_section "system"
#define keyboard_layout_parameter "XKBLAYOUT"
#define keyboard_section "keyboard"
#define console_font_parameter "CONSOLE_FONT"
#define console_font_section "locale"
#define num_lock_boot_parameter "NUMLOCK"
#define num_lock_boot_section "config"
#define language_parameter "LANG"
#define language_section "locale"
#define locale_parameter "LOCALE"
#define locale_section "locale"
#define LOCALE_get_command "ubconfig --source global get [locale] LOCALE"
#define HOSTNAME_get_command "ubconfig --source global get [system] HOSTNAME"
#define MACHINEID_get_command "ubconfig --source global get [system] MACHINEID"
#define CONSOLE_FONT_get_command "ubconfig --source global get [locale] CONSOLE_FONT"
// #define NUMLOCK_get_command "ubconfig --source global get [locale] NUMLOCK"
#define LANG_get_command "ubconfig --source global get [locale] LANG"
typedef char* string;
string version_application;

Loading…
Cancel
Save