changeset 18313:cf2fbfa205b1

merge of '44c5b35ad7903bcaed23711b5dbf0b7fcb261b47' and '45d61331479a783d9d6f26cee95a544336427125'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 27 Jun 2007 18:23:13 +0000
parents adcb44a07a2d (diff) a3469318cf35 (current diff)
children 7a8283c1eb75
files
diffstat 3 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Wed Jun 27 17:24:32 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Wed Jun 27 18:23:13 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 17:24:32 2007 +0000
+++ b/finch/libgnt/gntstyle.h	Wed Jun 27 18:23:13 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 17:24:32 2007 +0000
+++ b/finch/libgnt/wms/irssi.c	Wed Jun 27 18:23:13 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);