X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fcfg.c;h=f0332471d93b037b78d4130c9178d7e98bba9071;hb=573a01a68ca7cfc7c0afc6c128737dd05dd11625;hp=4cf1c7f62c9ea930d8863c6703914fb80e6a2b5d;hpb=270d8e258b541a4e481c7323a2c1feb49f19dc2e;p=psensor.git diff --git a/src/cfg.c b/src/cfg.c index 4cf1c7f..f033247 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -237,12 +237,12 @@ static void set_alpha_channeld_enabled(bool b) set_bool(KEY_ALPHA_CHANNEL_ENABLED, b); } -static enum sensorlist_position get_sensorlist_position(void) +enum sensorlist_position config_get_sensorlist_position(void) { return get_int(KEY_INTERFACE_SENSORLIST_POSITION); } -static void set_sensorlist_position(enum sensorlist_position pos) +void config_set_sensorlist_position(enum sensorlist_position pos) { set_int(KEY_INTERFACE_SENSORLIST_POSITION, pos); } @@ -418,7 +418,6 @@ struct config *config_load(void) c->graph_fgcolor = get_foreground_color(); c->graph_bg_alpha = get_graph_background_alpha(); c->alpha_channel_enabled = is_alpha_channel_enabled(); - c->sensorlist_position = get_sensorlist_position(); c->slog_enabled = is_slog_enabled(); c->slog_interval = config_get_slog_interval(); @@ -436,13 +435,6 @@ struct config *config_load(void) if (c->graph_monitoring_duration < 1) c->graph_monitoring_duration = 10; - c->menu_bar_disabled = get_bool(KEY_INTERFACE_MENU_BAR_DISABLED); - - c->unity_launcher_count_disabled - = get_bool(KEY_INTERFACE_UNITY_LAUNCHER_COUNT_DISABLED); - - c->hide_on_startup = get_bool(KEY_INTERFACE_HIDE_ON_STARTUP); - c->window_restore_enabled = get_bool(KEY_INTERFACE_WINDOW_RESTORE_ENABLED); @@ -458,8 +450,6 @@ struct config *config_load(void) c->window_h = 200; } - c->temperature_unit = get_int(KEY_INTERFACE_TEMPERATURE_UNIT); - c->sensor_values_max_length = compute_values_max_length(c); return c; @@ -471,7 +461,6 @@ void config_save(const struct config *c) set_background_color(c->graph_bgcolor); set_foreground_color(c->graph_fgcolor); set_graph_background_alpha(c->graph_bg_alpha); - set_sensorlist_position(c->sensorlist_position); set_slog_enabled(c->slog_enabled); set_slog_interval(c->slog_interval); @@ -481,11 +470,6 @@ void config_save(const struct config *c) set_int(KEY_SENSOR_UPDATE_INTERVAL, c->sensor_update_interval); - set_bool(KEY_INTERFACE_MENU_BAR_DISABLED, c->menu_bar_disabled); - - set_bool(KEY_INTERFACE_UNITY_LAUNCHER_COUNT_DISABLED, - c->unity_launcher_count_disabled); - set_bool(KEY_INTERFACE_HIDE_ON_STARTUP, c->hide_on_startup); set_bool(KEY_INTERFACE_WINDOW_RESTORE_ENABLED, @@ -497,8 +481,6 @@ void config_save(const struct config *c) set_int(KEY_INTERFACE_WINDOW_H, c->window_h); set_int(KEY_INTERFACE_WINDOW_DIVIDER_POS, c->window_divider_pos); - - set_int(KEY_INTERFACE_TEMPERATURE_UNIT, c->temperature_unit); } const char *get_psensor_user_dir(void) @@ -716,7 +698,8 @@ void config_set_sensor_color(const char *sid, const GdkRGBA *color) static const char *next_default_color(void) { /* copied from the default colors of the gtk color color - * chooser. */ + * chooser. + */ const char *default_colors[27] = { "#ef2929", /* Scarlet Red */ "#fcaf3e", /* Orange */ @@ -944,3 +927,28 @@ enum temperature_unit config_get_temperature_unit(void) { return get_int(KEY_INTERFACE_TEMPERATURE_UNIT); } + +void config_set_temperature_unit(enum temperature_unit u) +{ + set_int(KEY_INTERFACE_TEMPERATURE_UNIT, u); +} + +bool config_is_menu_bar_enabled(void) +{ + return !get_bool(KEY_INTERFACE_MENU_BAR_DISABLED); +} + +void config_set_menu_bar_enabled(bool enabled) +{ + set_bool(KEY_INTERFACE_MENU_BAR_DISABLED, !enabled); +} + +bool config_is_count_visible(void) +{ + return !get_bool(KEY_INTERFACE_UNITY_LAUNCHER_COUNT_DISABLED); +} + +void config_set_count_visible(bool visible) +{ + set_bool(KEY_INTERFACE_UNITY_LAUNCHER_COUNT_DISABLED, !visible); +}