@ -5,11 +5,13 @@ config main_config;
//functions
//functions
void yon_load_proceed ( YON_CONFIG_TYPE type ) {
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 ) ) { }
yon_config_clean ( ) ;
else {
yon_config_load_config ( YON_CONFIG_DEFAULT , config_get_default_command , NULL ) ;
textdomain ( template_ui_LocaleName ) ;
if ( type = = YON_CONFIG_GLOBAL ) {
yon_ubl_status_box_render ( LOAD_FAILED_LABEL , BACKGROUND_IMAGE_FAIL_TYPE ) ;
yon_config_load_config ( type , config_get_global_command , NULL ) ;
textdomain ( LocaleName ) ;
}
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 ( ) {
void yon_config_global_local_save ( ) {
int changed = yon_config_get_status ( id_parameter ) = = 1 ;
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 ( window ) {
if ( changed ) {
if ( changed ) {
yon_ubl_status_box_spawn_infinite ( GTK_CONTAINER ( window - > StatusBox ) , " warning " , SAVE_WARNING_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
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);
// 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 ( ) {
void yon_config_local_save ( ) {
int changed = yon_config_get_status ( id_parameter ) = = 1 ;
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 ( window ) {
if ( changed ) {
if ( changed ) {
yon_ubl_status_box_spawn_infinite ( GTK_CONTAINER ( window - > StatusBox ) , " warning " , SAVE_WARNING_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
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 ( ) {
void yon_config_global_save ( ) {
int changed = yon_config_get_status ( id_parameter ) = = 1 ;
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 ( window ) {
if ( changed ) {
if ( changed ) {
yon_ubl_status_box_spawn_infinite ( GTK_CONTAINER ( window - > StatusBox ) , " warning " , SAVE_WARNING_LABEL , BACKGROUND_IMAGE_SUCCESS_TYPE ) ;
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 ) ;
gtk_entry_set_text ( GTK_ENTRY ( widgets - > LocaleEntry ) , final_string ) ;
if ( yon_config_get_by_key ( " LOCALE " ) ) yon_config_set ( " LOCALE " , final_ids ) ;
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 ) ;
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 ) ) {
if ( yon_config_get_by_key ( hostname_parameter ) ) {
yon_config_set ( hostname_parameter , text ) ;
yon_config_set ( hostname_parameter , text ) ;
} else {
} 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 ) ) {
if ( yon_config_get_by_key ( id_parameter ) ) {
yon_config_set ( id_parameter , id = = 1 ? " random " : " hardware " ) ;
yon_config_set ( id_parameter , id = = 1 ? " random " : " hardware " ) ;
} else {
} 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 ) {
if ( id < 3 ) {
@ -287,7 +283,7 @@ void on_id_changed(GtkEntry *self, main_window *widgets){
if ( yon_config_get_by_key ( id_parameter ) ) {
if ( yon_config_get_by_key ( id_parameter ) ) {
yon_config_set ( id_parameter , text ) ;
yon_config_set ( id_parameter , text ) ;
} else {
} else {
yon_config_register ( id_parameter , id_section , text ) ;
yon_config_register ( id_parameter , MACHINEID_get_command , text ) ;
}
}
if ( ! main_config . lock_save_global )
if ( ! main_config . lock_save_global )
gtk_widget_set_sensitive ( widgets - > SaveGlobalMenuItem , 1 ) ;
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 ) ) {
if ( yon_config_get_by_key ( console_font_parameter ) ) {
yon_config_set ( console_font_parameter , code ) ;
yon_config_set ( console_font_parameter , code ) ;
} else {
} 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 ) ) {
if ( yon_config_get_by_key ( language_parameter ) ) {
yon_config_set ( language_parameter , code ) ;
yon_config_set ( language_parameter , code ) ;
} else {
} else {
yon_config_register ( language_parameter , language_section , code ) ;
yon_config_register ( language_parameter , LANG_get_command , code ) ;
}
}
}
}