diff options
author | TingPing <tingping@tingping.se> | 2014-12-15 15:33:10 -0500 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2014-12-15 15:34:12 -0500 |
commit | 76c2cfebc35a007cbbd3ae3ab66b64799fd62f8e (patch) | |
tree | 4c4d230c5c582a507a171197d04f36b83ff2851b /plugins | |
parent | addefa9ef139af1d3a910336d471637a53d15502 (diff) |
Don't require glib 2.40
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/fishlim/keystore.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/fishlim/keystore.c b/plugins/fishlim/keystore.c index 45cca668..8cb12912 100644 --- a/plugins/fishlim/keystore.c +++ b/plugins/fishlim/keystore.c @@ -125,6 +125,26 @@ static bool delete_nick(GKeyFile *keyfile, const char *nick) { 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. */ @@ -133,7 +153,11 @@ static bool save_keystore(GKeyFile *keyfile) { bool ok; 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); +#endif g_free (filename); return ok; |