mirror of
https://github.com/hexchat/hexchat.git
synced 2024-11-05 10:42:33 +01:00
Don't require glib 2.40
This commit is contained in:
parent
addefa9ef1
commit
76c2cfebc3
@ -125,6 +125,26 @@ static bool delete_nick(GKeyFile *keyfile, const char *nick) {
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !GLIB_CHECK_VERSION(2,40,0)
|
||||||
|
/**
|
||||||
|
* Writes the key store file to disk.
|
||||||
|
*/
|
||||||
|
static gboolean keyfile_save_to_file (GKeyFile *keyfile, char *filename) {
|
||||||
|
gboolean ok;
|
||||||
|
|
||||||
|
/* Serialize */
|
||||||
|
gsize file_length;
|
||||||
|
gchar *file_data = g_key_file_to_data(keyfile, &file_length, NULL);
|
||||||
|
if (!file_data)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Write to file */
|
||||||
|
ok = g_file_set_contents (filename, file_data, file_length, NULL);
|
||||||
|
g_free(file_data);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes the key store file to disk.
|
* Writes the key store file to disk.
|
||||||
*/
|
*/
|
||||||
@ -133,7 +153,11 @@ static bool save_keystore(GKeyFile *keyfile) {
|
|||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
filename = get_config_filename();
|
filename = get_config_filename();
|
||||||
|
#if !GLIB_CHECK_VERSION(2,40,0)
|
||||||
|
ok = keyfile_save_to_file (keyfile, filename);
|
||||||
|
#else
|
||||||
ok = g_key_file_save_to_file (keyfile, filename, NULL);
|
ok = g_key_file_save_to_file (keyfile, filename, NULL);
|
||||||
|
#endif
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
|
Loading…
Reference in New Issue
Block a user