X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=config-ui%2Fbrowser-switchboard-cp.c;h=c34778b90021428ec76de70637a494cfad9d2186;hp=54d590f9e29fbf32efce4810c8f12e726d95a133;hb=e9c581ab58322ed67df8429a43cfbc836f84ca75;hpb=2cde803af3bfd1830eb40235b2a226454053e43f diff --git a/config-ui/browser-switchboard-cp.c b/config-ui/browser-switchboard-cp.c index 54d590f..c34778b 100644 --- a/config-ui/browser-switchboard-cp.c +++ b/config-ui/browser-switchboard-cp.c @@ -2,7 +2,8 @@ * browser-switchboard-cp.c -- a hildon-control-panel applet for * selecting the default browser for Browser Switchboard * - * Copyright (C) 2009 Steven Luo + * Copyright (C) 2009-2010 Steven Luo + * Copyright (C) 2009-2010 Faheem Pervez * * Derived from services-cp.c from maemo-control-services * Copyright (c) 2008 Janne Kataja @@ -71,6 +72,8 @@ struct browser_entry browsers[] = { { NULL, NULL }, }; +char *logger_name = NULL; + struct config_widgets { #if defined(HILDON) && defined(FREMANTLE) GtkWidget *continuous_mode_selector; @@ -168,20 +171,25 @@ static void load_config(void) { set_continuous_mode(atoi(line.value)); continuous_mode_seen = 1; } + free(line.value); } else if (!strcmp(line.key, "default_browser")) { if (!default_browser_seen) { set_default_browser(line.value); default_browser_seen = 1; } + free(line.value); } else if (!strcmp(line.key, "other_browser_cmd")) { if (!other_browser_cmd_seen) { set_other_browser_cmd(line.value); other_browser_cmd_seen = 1; } + free(line.value); + } else if (!strcmp(line.key, "logging")) { + if (!logger_name) + logger_name = line.value; } } free(line.key); - free(line.value); } parse_config_file_end(); @@ -260,6 +268,15 @@ static void save_config(void) { get_other_browser_cmd()); other_browser_cmd_seen = 1; } + } else if (!strcmp(line.key, + "logging")) { + if (logger_name) { + fprintf(tmpfp, "%s = \"%s\"\n", + line.key, + logger_name); + free(logger_name); + logger_name = NULL; + } } } else { /* Just copy the old line over */ @@ -281,6 +298,9 @@ static void save_config(void) { if (!other_browser_cmd_seen && strlen(get_other_browser_cmd()) > 0) fprintf(tmpfp, "%s = \"%s\"\n", "other_browser_cmd", get_other_browser_cmd()); + if (logger_name) + fprintf(tmpfp, "%s = \"%s\"\n", + "logging", logger_name); /* Replace the old config file with the new one */ fclose(tmpfp); @@ -301,7 +321,7 @@ static void do_reconfig(void) { save_config(); /* Try to send SIGHUP to any running browser-switchboard process - This causes it to reread config files if in continuous_mode, and + This causes it to reread config files if in continuous_mode, or die so that the config will be reloaded on next start otherwise */ system("kill -HUP `pidof browser-switchboard` > /dev/null 2>&1"); }