diff finch/libgnt/gntstyle.c @ 18068:0b3d6ea61760

propagate from branch 'im.pidgin.pidgin' (head 4b50880d8517570eaa67d4cd9d88c5934bb832f1) to branch 'im.pidgin.pidgin.2.1.0' (head fefd59692d4177b91d52f6d71b1565b76c88725d)
author Richard Laager <rlaager@wiktel.com>
date Thu, 07 Jun 2007 14:48:33 +0000
parents 1cedd520cd18
children 08776fc5c06f
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Thu Jun 07 14:47:30 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Thu Jun 07 14:48:33 2007 +0000
@@ -1,6 +1,29 @@
+/**
+ * GNT - The GLib Ncurses Toolkit
+ *
+ * GNT is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
 #include "gntstyle.h"
 #include "gntcolors.h"
 
+#include <glib.h>
 #include <ctype.h>
 #include <string.h>
 
@@ -8,6 +31,7 @@
 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];
@@ -17,6 +41,11 @@
 	return str_styles[style];
 }
 
+const char *gnt_style_get_from_name(const char *name)
+{
+	return g_hash_table_lookup(unknowns, name);
+}
+
 gboolean gnt_style_get_bool(GntStyle style, gboolean def)
 {
 	int i;
@@ -221,6 +250,10 @@
 			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);
 }
@@ -231,6 +264,7 @@
 #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))
 	{
@@ -260,6 +294,7 @@
 	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