aboutsummaryrefslogtreecommitdiff
path: root/trayfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'trayfreq.c')
-rw-r--r--trayfreq.c42
1 files changed, 17 insertions, 25 deletions
diff --git a/trayfreq.c b/trayfreq.c
index e3b925e..7e5d8d4 100644
--- a/trayfreq.c
+++ b/trayfreq.c
@@ -63,39 +63,31 @@ void config_init()
config.file_name = g_strconcat("/usr/share/trayfreq/trayfreq.config", NULL);
gboolean success = config_open(&config);
-
if(!success)
{
debug("Couldn't open '%s' for reading\n",config.file_name);
g_warning(_("Failed to open config files!\n"));
return;
}
-
- gchar * def_gov = config_get_key(&config, "governor", "default");
- gchar * def_freq = config_get_key(&config, "frequency", "default");
- gchar * show_bat = config_get_key(&config, "battery", "show");
- gchar * bat_gov = config_get_key (&config, "battery", "governor");
- gchar * ac_gov = config_get_key (&config, "ac", "governor");
-
- if(def_gov)
- _DEFAULT_GOV = def_gov;
-
- if(def_freq)
- _DEFAULT_FREQ = def_freq;
-
- if (bat_gov)
- _DEFAULT_BAT_GOV = bat_gov;
-
- if (ac_gov)
- _DEFAULT_AC_GOV = ac_gov;
-
- if(show_bat)
+ _DEFAULT_GOV = config_get_key(&config, "governor", "default");
+ _DEFAULT_FREQ = config_get_key(&config, "frequency", "default");
+ _DEFAULT_BAT_GOV = config_get_key(&config, "battery", "governor");
+ _DEFAULT_AC_GOV = config_get_key(&config, "ac", "governor");
+
+ char* temp = config_get_key(&config, "battery", "show");
+ if (temp)
+ SHOW_BATTERY = ( temp[0] == '1' );
+
+ temp = config_get_key(&config, "extra", "sudo");
+ if (temp)
{
- if(g_strcmp0(show_bat, "1") == 0)
- SHOW_BATTERY = TRUE;
- else
- SHOW_BATTERY = FALSE;
+ _DEFAULT_USE_SUDO = ( temp[0] == '1' );
+ debug("woo\n");
}
+
+
+ debug("%s sudo\n",_DEFAULT_USE_SUDO? "Using" : "Not using");
+
g_free(config.file_name);
config_close(&config);
}