comparison finch/libgnt/gntstyle.c @ 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 8aff2d3d6820
children 9f029b7208f1 c6282dc3fb9f
comparison
equal deleted inserted replaced
18361:9b5b0cbde65f 18362:65ed0916d3bc
267 static void 267 static void
268 read_general_style(GKeyFile *kfile) 268 read_general_style(GKeyFile *kfile)
269 { 269 {
270 GError *error = NULL; 270 GError *error = NULL;
271 gsize nkeys; 271 gsize nkeys;
272 char **keys = g_key_file_get_keys(kfile, "general", &nkeys, &error); 272 const char *prgname = g_get_prgname();
273 char **keys = NULL;
273 int i; 274 int i;
274 struct 275 struct
275 { 276 {
276 const char *style; 277 const char *style;
277 GntStyle en; 278 GntStyle en;
280 {"mouse", GNT_STYLE_MOUSE}, 281 {"mouse", GNT_STYLE_MOUSE},
281 {"wm", GNT_STYLE_WM}, 282 {"wm", GNT_STYLE_WM},
282 {"remember_position", GNT_STYLE_REMPOS}, 283 {"remember_position", GNT_STYLE_REMPOS},
283 {NULL, 0}}; 284 {NULL, 0}};
284 285
286 if (prgname && *prgname)
287 keys = g_key_file_get_keys(kfile, prgname, &nkeys, NULL);
288
289 if (keys == NULL) {
290 prgname = "general";
291 keys = g_key_file_get_keys(kfile, prgname, &nkeys, &error);
292 }
293
285 if (error) 294 if (error)
286 { 295 {
287 g_printerr("GntStyle: %s\n", error->message); 296 g_printerr("GntStyle: %s\n", error->message);
288 g_error_free(error); 297 g_error_free(error);
289 } 298 }
290 else 299 else
291 { 300 {
292 for (i = 0; styles[i].style; i++) 301 for (i = 0; styles[i].style; i++)
293 { 302 {
294 str_styles[styles[i].en] = 303 str_styles[styles[i].en] =
295 g_key_file_get_string(kfile, "general", styles[i].style, NULL); 304 g_key_file_get_string(kfile, prgname, styles[i].style, NULL);
296 } 305 }
297 } 306 }
298 g_strfreev(keys); 307 g_strfreev(keys);
299 } 308 }
300 #endif 309 #endif