Added check for glib version in mc_config_del_param and mc_config_del_group functions

configure.ac: Added check for minimal version of Glib2

Since Glib2-2.15 API of file-ini module was changed.
Old API:
void g_key_file_remove_key(...)
New API:
gboolean g_key_file_remove_key(...)

Therefore need to check version of Glib and fix return parameter from mc_config_del_param and mc_config_del_group for success build

Work with ini-file added in Glib2 since version 2.6, therefore in configure.ac added this check.
This commit is contained in:
Slava Zanko 2009-05-14 14:47:14 +03:00
parent 4648ad8bf9
commit 483a1a05aa
2 changed files with 11 additions and 2 deletions

View File

@ -48,7 +48,7 @@ AC_ARG_WITH([glib_static],
glib_found=no
if test "x$with_glib12" != "xyes"; then
PKG_CHECK_MODULES(GLIB, [glib-2.0], [glib_found=yes], [:])
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.6], [glib_found=yes], [:])
fi
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0], [gmodule_found=yes])

View File

@ -112,8 +112,12 @@ mc_config_del_param (mc_config_t * mc_config, const char *group,
{
if (!mc_config || !group || !param)
return FALSE;
#if GLIB_CHECK_VERSION (2, 15, 0)
return g_key_file_remove_key (mc_config->handle, group, param, NULL);
#else
g_key_file_remove_key (mc_config->handle, group, param, NULL);
return TRUE;
#endif
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
@ -124,7 +128,12 @@ mc_config_del_group (mc_config_t * mc_config, const char *group)
if (!mc_config || !group)
return FALSE;
#if GLIB_CHECK_VERSION (2, 15, 0)
return g_key_file_remove_group (mc_config->handle, group, NULL);
#else
g_key_file_remove_group (mc_config->handle, group, NULL);
return TRUE;
#endif
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */