changeset 18320:bd137144da3c

merge of '816f8d7bf86bf8e3853b6a663bed65843b2d8a38' and 'e53fe113efde971f9f1d14d8a7af937542ee2732'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 27 Jun 2007 20:51:12 +0000
parents 9b3c2ba1a5c3 (current diff) c7d344acd1ff (diff)
children 477a6ddd56a0
files
diffstat 3 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Wed Jun 27 20:19:15 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Wed Jun 27 20:51:12 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
--- a/finch/libgnt/gntstyle.h	Wed Jun 27 20:19:15 2007 +0000
+++ b/finch/libgnt/gntstyle.h	Wed Jun 27 20:51:12 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);
 
 /**
  * 
--- a/finch/libgnt/wms/irssi.c	Wed Jun 27 20:19:15 2007 +0000
+++ b/finch/libgnt/wms/irssi.c	Wed Jun 27 20:51:12 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);