test fix for g_key_file error

pull/21/head
parent 0c03edea09
commit c5d850447e

@ -180,54 +180,57 @@ void yon_terminal_integrated_start_shell(GtkWidget *terminal, char* command, voi
static char *__yon_window_config_path = NULL; static char *__yon_window_config_path = NULL;
void yon_window_config_save(){ void yon_window_config_save(){
check_window_config_setup {
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x); g_key_file_set_integer(__yon_window_config_file,"window","WindowPosX",__yon_main_window_config.x);
g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y); g_key_file_set_integer(__yon_window_config_file,"window","WindowPosY",__yon_main_window_config.y);
g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width); g_key_file_set_integer(__yon_window_config_file,"window","WindowWidth",__yon_main_window_config.width);
g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height); g_key_file_set_integer(__yon_window_config_file,"window","WindowHeight",__yon_main_window_config.height);
g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen); g_key_file_set_integer(__yon_window_config_file,"window","fullscreen",__yon_main_window_config.fullscreen);
dictionary *dict=NULL; dictionary *dict=NULL;
if (__yon_main_window_config.deleted_parameters) if (__yon_main_window_config.deleted_parameters)
for_dictionaries(dict,__yon_main_window_config.deleted_parameters){ for_dictionaries(dict,__yon_main_window_config.deleted_parameters){
__yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); __yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*);
g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL); g_key_file_remove_key(__yon_window_config_file,param->section,param->parameter_name,NULL);
}
if (__yon_main_window_config.custom_listeners)
for_dictionaries(dict,__yon_main_window_config.custom_listeners){
__yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*);
GValue *val = g_malloc0(sizeof(GValue));
g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val);
switch(param->containing_type){
case YON_TYPE_STRING:
g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val));
break;
case YON_TYPE_INT:
g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val));
break;
case YON_TYPE_BOOLEAN:
g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val));
break;
case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break;
} }
} if (__yon_main_window_config.custom_listeners)
if (__yon_main_window_config.custom_parameters) for_dictionaries(dict,__yon_main_window_config.custom_listeners){
for_dictionaries(dict,__yon_main_window_config.custom_parameters){ __yon_listener_parameter *param = yon_dictionary_get_data(dict,__yon_listener_parameter*);
__yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*); GValue *val = g_malloc0(sizeof(GValue));
switch (param->containing_type){ g_object_get_property(G_OBJECT(param->track_widget),param->property_name,val);
case YON_TYPE_STRING: switch(param->containing_type){
g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property); case YON_TYPE_STRING:
break; g_key_file_set_string(__yon_window_config_file,"window",param->parameter_name, g_value_get_string(val));
case YON_TYPE_INT: break;
g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property); case YON_TYPE_INT:
break; g_key_file_set_integer(__yon_window_config_file,"window",param->parameter_name, g_value_get_int(val));
case YON_TYPE_BOOLEAN: break;
g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property); case YON_TYPE_BOOLEAN:
break; g_key_file_set_boolean(__yon_window_config_file,"window",param->parameter_name, g_value_get_boolean(val));
default: break;
break; case YON_TYPE_OTHER:printf("\033[0;31mCannot save %s property with %s key\033[0m\n",param->property_name,param->parameter_name);break;
}
} }
if (__yon_main_window_config.custom_parameters)
for_dictionaries(dict,__yon_main_window_config.custom_parameters){
__yon_custom_parameter *param = yon_dictionary_get_data(dict,__yon_custom_parameter*);
switch (param->containing_type){
case YON_TYPE_STRING:
g_key_file_set_string(__yon_window_config_file,param->section,param->parameter_name, (char*)param->property);
break;
case YON_TYPE_INT:
g_key_file_set_integer(__yon_window_config_file,param->section,param->parameter_name, *(int*)param->property);
break;
case YON_TYPE_BOOLEAN:
g_key_file_set_boolean(__yon_window_config_file,param->section,param->parameter_name, *(gboolean*)param->property);
break;
default:
break;
}
}
g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL);
} }
g_key_file_save_to_file(__yon_window_config_file,__yon_window_config_path,NULL);
} }
void yon_get_is_fullscreen(){ void yon_get_is_fullscreen(){

Loading…
Cancel
Save