changeset 18362:65ed0916d3bc

Allowing specifying different styles for different applications.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 30 Jun 2007 00:53:24 +0000
parents 9b5b0cbde65f
children 1aa08373442f
files finch/libgnt/gntstyle.c
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Sat Jun 30 00:35:53 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Sat Jun 30 00:53:24 2007 +0000
@@ -269,7 +269,8 @@
 {
 	GError *error = NULL;
 	gsize nkeys;
-	char **keys = g_key_file_get_keys(kfile, "general", &nkeys, &error);
+	const char *prgname = g_get_prgname();
+	char **keys = NULL;
 	int i;
 	struct
 	{
@@ -282,6 +283,14 @@
 	              {"remember_position", GNT_STYLE_REMPOS},
 	              {NULL, 0}};
 
+	if (prgname && *prgname)
+		keys = g_key_file_get_keys(kfile, prgname, &nkeys, NULL);
+
+	if (keys == NULL) {
+		prgname = "general";
+		keys = g_key_file_get_keys(kfile, prgname, &nkeys, &error);
+	}
+
 	if (error)
 	{
 		g_printerr("GntStyle: %s\n", error->message);
@@ -292,7 +301,7 @@
 		for (i = 0; styles[i].style; i++)
 		{
 			str_styles[styles[i].en] =
-					g_key_file_get_string(kfile, "general", styles[i].style, NULL);
+					g_key_file_get_string(kfile, prgname, styles[i].style, NULL);
 		}
 	}
 	g_strfreev(keys);