X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_pref.c;h=04ea5c477127051c35770370164ee7112cf2029e;hb=cc35e177d57bc4ee2cc57ae25f130dfc168aa61d;hp=76fabbc392b026a3faf59ac928cb24637e613c85;hpb=6bc514333f857af0e986168e2f703d824b4924f8;p=psensor.git diff --git a/src/ui_pref.c b/src/ui_pref.c index 76fabbc..04ea5c4 100644 --- a/src/ui_pref.c +++ b/src/ui_pref.c @@ -1,22 +1,21 @@ /* - Copyright (C) 2010-2011 jeanfi@gmail.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - + * Copyright (C) 2010-2013 jeanfi@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #include #include @@ -47,13 +46,14 @@ void ui_pref_dialog_run(struct ui_psensor *ui) GError *error = NULL; GdkColor *color_fg, *color_bg; GtkColorButton *w_color_fg, *w_color_bg; - GtkHScale *w_bg_opacity; + GtkScale *w_bg_opacity; GtkSpinButton *w_update_interval, *w_monitoring_duration, *w_s_update_interval; 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; @@ -82,8 +82,8 @@ void ui_pref_dialog_run(struct ui_psensor *ui) "color_bg")); gtk_color_button_set_color(w_color_bg, color_bg); - w_bg_opacity = GTK_HSCALE(gtk_builder_get_object(builder, - "bg_opacity")); + w_bg_opacity = GTK_SCALE(gtk_builder_get_object(builder, + "bg_opacity")); gtk_range_set_value(GTK_RANGE(w_bg_opacity), cfg->graph_bg_alpha); w_update_interval = GTK_SPIN_BUTTON(gtk_builder_get_object @@ -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")); @@ -137,13 +141,19 @@ void ui_pref_dialog_run(struct ui_psensor *ui) gtk_toggle_button_set_active(w_win_restore, cfg->window_restore_enabled); + w_temp_unit + = GTK_COMBO_BOX_TEXT(gtk_builder_get_object + (builder, "temperature_unit")); + gtk_combo_box_set_active(GTK_COMBO_BOX(w_temp_unit), + cfg->temperature_unit); + result = gtk_dialog_run(diag); if (result == GTK_RESPONSE_ACCEPT) { double value; GdkColor color; - g_mutex_lock(ui->sensors_mutex); + pthread_mutex_lock(&ui->sensors_mutex); gtk_color_button_get_color(w_color_fg, &color); color_set(cfg->graph_fgcolor, @@ -203,9 +213,15 @@ 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)); + config_save(cfg); - g_mutex_unlock(ui->sensors_mutex); + pthread_mutex_unlock(&ui->sensors_mutex); ui_window_update(ui); }