X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_pref.c;h=cc4be17034aaeecf3f67398420f288cf1d2c767d;hb=e57d7f801ae20f02e0cb28107a89b31fa51de1c1;hp=2663f986696cf24f16dceebb1080aaa208d63ab9;hpb=e34af72ddaecb2baf56a0e0a7e135e8f25861ba2;p=psensor.git diff --git a/src/ui_pref.c b/src/ui_pref.c index 2663f98..cc4be17 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-2012 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; + GtkComboBoxText *w_temp_unit; cfg = ui->config; @@ -65,7 +65,7 @@ void ui_pref_dialog_run(struct ui_psensor *ui) &error); if (!ok) { - g_warning("%s", error->message); + log_printf(LOG_ERR, error->message); g_error_free(error); return ; } @@ -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 @@ -137,6 +137,13 @@ 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) { @@ -203,6 +210,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui) cfg->window_restore_enabled = gtk_toggle_button_get_active(w_win_restore); + cfg->temperature_unit + = gtk_combo_box_get_active(GTK_COMBO_BOX(w_temp_unit)); + config_save(cfg); g_mutex_unlock(ui->sensors_mutex);