forked from Miroirs/x49gp
fix naming mistake: x49gp->state was never a filename but a loaded ini file
This commit is contained in:
parent
9f77361637
commit
08271cf4c2
2 changed files with 8 additions and 8 deletions
|
@ -101,16 +101,16 @@ int x49gp_modules_load( x49gp_t* x49gp, const char* filename )
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
x49gp->state_filename = g_key_file_new();
|
x49gp->state = g_key_file_new();
|
||||||
if ( NULL == x49gp->state_filename ) {
|
if ( NULL == x49gp->state ) {
|
||||||
fprintf( stderr, "%s:%u: g_key_file_new: Out of memory\n", __FUNCTION__, __LINE__ );
|
fprintf( stderr, "%s:%u: g_key_file_new: Out of memory\n", __FUNCTION__, __LINE__ );
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !g_key_file_load_from_file( x49gp->state_filename, filename, G_KEY_FILE_KEEP_COMMENTS, &gerror ) &&
|
if ( !g_key_file_load_from_file( x49gp->state, filename, G_KEY_FILE_KEEP_COMMENTS, &gerror ) &&
|
||||||
!g_error_matches( gerror, G_FILE_ERROR, G_FILE_ERROR_NOENT ) ) {
|
!g_error_matches( gerror, G_FILE_ERROR, G_FILE_ERROR_NOENT ) ) {
|
||||||
fprintf( stderr, "%s:%u: g_key_file_load_from_file: %s\n", __FUNCTION__, __LINE__, gerror->message );
|
fprintf( stderr, "%s:%u: g_key_file_load_from_file: %s\n", __FUNCTION__, __LINE__, gerror->message );
|
||||||
g_key_file_free( x49gp->state_filename );
|
g_key_file_free( x49gp->state );
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ int x49gp_modules_load( x49gp_t* x49gp, const char* filename )
|
||||||
|
|
||||||
list_for_each_entry( module, &x49gp->modules, list )
|
list_for_each_entry( module, &x49gp->modules, list )
|
||||||
{
|
{
|
||||||
error = module->load( module, x49gp->state_filename );
|
error = module->load( module, x49gp->state );
|
||||||
if ( error ) {
|
if ( error ) {
|
||||||
if ( error == -EAGAIN )
|
if ( error == -EAGAIN )
|
||||||
result = -EAGAIN;
|
result = -EAGAIN;
|
||||||
|
@ -155,12 +155,12 @@ int x49gp_modules_save( x49gp_t* x49gp, const char* filename )
|
||||||
|
|
||||||
list_for_each_entry( module, &x49gp->modules, list )
|
list_for_each_entry( module, &x49gp->modules, list )
|
||||||
{
|
{
|
||||||
error = module->save( module, x49gp->state_filename );
|
error = module->save( module, x49gp->state );
|
||||||
if ( error )
|
if ( error )
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = g_key_file_to_data( x49gp->state_filename, &length, &gerror );
|
data = g_key_file_to_data( x49gp->state, &length, &gerror );
|
||||||
if ( NULL == data ) {
|
if ( NULL == data ) {
|
||||||
fprintf( stderr, "%s:%u: g_key_file_to_data: %s\n", __FUNCTION__, __LINE__, gerror->message );
|
fprintf( stderr, "%s:%u: g_key_file_to_data: %s\n", __FUNCTION__, __LINE__, gerror->message );
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -83,7 +83,7 @@ struct __x49gp_s__ {
|
||||||
|
|
||||||
x49gp_ui_t* ui;
|
x49gp_ui_t* ui;
|
||||||
|
|
||||||
GKeyFile* state_filename;
|
GKeyFile* state;
|
||||||
const char* progname;
|
const char* progname;
|
||||||
const char* progpath;
|
const char* progpath;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue