# HG changeset patch # User Sean Egan # Date 1182977027 0 # Node ID e92ae9e3d9feaaf18a63d398e2394c3927c366f5 # Parent 6fa1bbf6b0a9baab2cd25b4803d40064a4d31f4f# Parent c7d344acd1ff2c4e152dc5c15ae0278013fe5350 merge of 'a1842200c8a0003dcb3a203be6a3b96be5c724e7' and 'e53fe113efde971f9f1d14d8a7af937542ee2732' diff -r 6fa1bbf6b0a9 -r e92ae9e3d9fe finch/libgnt/gntstyle.c --- a/finch/libgnt/gntstyle.c Wed Jun 27 20:42:04 2007 +0000 +++ b/finch/libgnt/gntstyle.c Wed Jun 27 20:43:47 2007 +0000 @@ -36,7 +36,6 @@ static GKeyFile *gkfile; #endif -static GHashTable *unknowns; static char * str_styles[GNT_STYLES]; static int int_styles[GNT_STYLES]; static int bool_styles[GNT_STYLES]; @@ -46,9 +45,11 @@ return str_styles[style]; } -const char *gnt_style_get_from_name(const char *name) +const char *gnt_style_get_from_name(const char *group, const char *key) { - return g_hash_table_lookup(unknowns, name); +#if GLIB_CHECK_VERSION(2,6,0) + return g_key_file_get_value(gkfile, group, key, NULL); +#endif } gboolean gnt_style_get_bool(GntStyle style, gboolean def) @@ -293,10 +294,6 @@ str_styles[styles[i].en] = g_key_file_get_string(kfile, "general", styles[i].style, NULL); } - - for (i = 0; i < nkeys; i++) - g_hash_table_replace(unknowns, g_strdup(keys[i]), - g_strdup(g_key_file_get_string(kfile, "general", keys[i], NULL))); } g_strfreev(keys); } @@ -307,9 +304,9 @@ #if GLIB_CHECK_VERSION(2,6,0) GError *error = NULL; gkfile = g_key_file_new(); - unknowns = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - if (!g_key_file_load_from_file(gkfile, filename, G_KEY_FILE_NONE, &error)) + if (!g_key_file_load_from_file(gkfile, filename, + G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error)) { g_printerr("GntStyle: %s\n", error->message); g_error_free(error); @@ -337,7 +334,6 @@ for (i = 0; i < GNT_STYLES; i++) g_free(str_styles[i]); - g_hash_table_destroy(unknowns); #if GLIB_CHECK_VERSION(2,6,0) g_key_file_free(gkfile); #endif diff -r 6fa1bbf6b0a9 -r e92ae9e3d9fe finch/libgnt/gntstyle.h --- a/finch/libgnt/gntstyle.h Wed Jun 27 20:42:04 2007 +0000 +++ b/finch/libgnt/gntstyle.h Wed Jun 27 20:43:47 2007 +0000 @@ -45,7 +45,7 @@ const char *gnt_style_get(GntStyle style); -const char *gnt_style_get_from_name(const char *key); +const char *gnt_style_get_from_name(const char *group, const char *key); /** * diff -r 6fa1bbf6b0a9 -r e92ae9e3d9fe finch/libgnt/wms/irssi.c --- a/finch/libgnt/wms/irssi.c Wed Jun 27 20:42:04 2007 +0000 +++ b/finch/libgnt/wms/irssi.c Wed Jun 27 20:43:47 2007 +0000 @@ -280,10 +280,10 @@ irssi = g_object_new(TYPE_IRSSI, NULL); *wm = GNT_WM(irssi); - style = gnt_style_get_from_name("irssi-split-v"); + style = gnt_style_get_from_name("irssi", "split-v"); irssi->vert = style ? atoi(style) : 1; - style = gnt_style_get_from_name("irssi-split-h"); + style = gnt_style_get_from_name("irssi", "split-h"); irssi->horiz = style ? atoi(style) : 1; irssi->vert = MAX(irssi->vert, 1);