From 12388f81cb55cca6fba194a1fc02870242dddef5 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Sat, 25 Aug 2012 10:27:34 +0000 Subject: [PATCH] added slog enable checkbox --- configure | 9 ++++----- po/Makefile.in | 2 +- src/cfg.c | 13 +++++++++++++ src/cfg.h | 2 ++ src/glade/psensor-pref.glade | 28 ++++++++++++++++++++++++++++ src/ui_pref.c | 9 ++++++++- 6 files changed, 56 insertions(+), 7 deletions(-) diff --git a/configure b/configure index f4201f5..a61f997 100755 --- a/configure +++ b/configure @@ -4670,13 +4670,12 @@ fi done -for ac_header in arpa/inet.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h getopt.h +for ac_header in stdbool.h do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + ac_fn_c_check_header_mongrel "$LINENO" "stdbool.h" "ac_cv_header_stdbool_h" "$ac_includes_default" +if test "x$ac_cv_header_stdbool_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_STDBOOL_H 1 _ACEOF fi diff --git a/po/Makefile.in b/po/Makefile.in index 70e0621..e5e2145 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -21,7 +21,7 @@ srcdir = . top_srcdir = .. -prefix = /usr/local +prefix = /tmp exec_prefix = ${prefix} datarootdir = ${prefix}/share datadir = ${datarootdir} diff --git a/src/cfg.c b/src/cfg.c index f0e53aa..5a6f8e8 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -91,6 +91,8 @@ static const char *KEY_INTERFACE_WINDOW_DIVIDER_POS static const char *KEY_INTERFACE_TEMPERATURE_UNIT = "/apps/psensor/interface/temperature_unit"; +static const char *KEY_SLOG_ENABLED = "/apps/psensor/slog/enabled"; + static GConfClient *client; static char *get_string(const char *key, const char *default_value) @@ -385,6 +387,15 @@ void config_set_appindicator_enabled(const char *sid, bool enabled) free(key); } +static bool is_slog_enabled() +{ + return gconf_client_get_bool(client, KEY_SLOG_ENABLED, NULL); +} + +static void set_slog_enabled(bool enabled) +{ + gconf_client_set_bool(client, KEY_SLOG_ENABLED, enabled, NULL); +} static bool is_window_decoration_enabled() { @@ -446,6 +457,7 @@ struct config *config_load() c->sensorlist_position = get_sensorlist_position(); c->window_decoration_enabled = is_window_decoration_enabled(); c->window_keep_below_enabled = is_window_keep_below_enabled(); + c->slog_enabled = is_slog_enabled(); c->sensor_update_interval = gconf_client_get_int(client, KEY_SENSOR_UPDATE_INTERVAL, NULL); @@ -526,6 +538,7 @@ void config_save(const struct config *c) set_sensorlist_position(c->sensorlist_position); set_window_decoration_enabled(c->window_decoration_enabled); set_window_keep_below_enabled(c->window_keep_below_enabled); + set_slog_enabled(c->slog_enabled); gconf_client_set_int(client, KEY_GRAPH_UPDATE_INTERVAL, diff --git a/src/cfg.h b/src/cfg.h index 4319db9..97fe357 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -72,6 +72,8 @@ struct config { int hide_on_startup; enum temperature_unit temperature_unit; + + bool slog_enabled; }; /* diff --git a/src/glade/psensor-pref.glade b/src/glade/psensor-pref.glade index e7dcf9f..de298d8 100644 --- a/src/glade/psensor-pref.glade +++ b/src/glade/psensor-pref.glade @@ -654,6 +654,28 @@ 1 + + + Enable log of measures + False + True + True + False + 4 + 4 + 4 + 4 + False + 0 + True + + + 0 + 1 + 3 + 1 + + 2 @@ -671,6 +693,12 @@ False + + + + + + False diff --git a/src/ui_pref.c b/src/ui_pref.c index bbca2a8..8748365 100644 --- a/src/ui_pref.c +++ b/src/ui_pref.c @@ -52,7 +52,7 @@ void ui_pref_dialog_run(struct ui_psensor *ui) GtkComboBox *w_sensorlist_pos; GtkToggleButton *w_hide_window_decoration, *w_keep_window_below, *w_enable_menu, *w_enable_launcher_counter, *w_hide_on_startup, - *w_win_restore; + *w_win_restore, *w_slog_enabled; GtkComboBoxText *w_temp_unit; cfg = ui->config; @@ -126,6 +126,10 @@ void ui_pref_dialog_run(struct ui_psensor *ui) gtk_toggle_button_set_active(w_enable_launcher_counter, !cfg->unity_launcher_count_disabled); + w_slog_enabled = GTK_TOGGLE_BUTTON + (gtk_builder_get_object(builder, "enable_slog")); + gtk_toggle_button_set_active(w_slog_enabled, cfg->slog_enabled); + w_hide_on_startup = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "hide_on_startup")); @@ -209,6 +213,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui) cfg->window_restore_enabled = gtk_toggle_button_get_active(w_win_restore); + cfg->slog_enabled + = gtk_toggle_button_get_active(w_slog_enabled); + cfg->temperature_unit = gtk_combo_box_get_active(GTK_COMBO_BOX(w_temp_unit)); -- 2.7.4