removed compat.h because gtk2 is no more supported since a while
[psensor.git] / src / ui_pref.c
index cc4be17..051c340 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 jeanfi@gmail.com
+ * 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
@@ -23,7 +23,6 @@
 #include "cfg.h"
 #include "ui_pref.h"
 #include "ui_color.h"
-#include "compat.h"
 
 GdkColor *color_to_gdkcolor(struct color *color)
 {
@@ -48,11 +47,11 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
        GtkColorButton *w_color_fg, *w_color_bg;
        GtkScale *w_bg_opacity;
        GtkSpinButton *w_update_interval, *w_monitoring_duration,
-               *w_s_update_interval;
+               *w_s_update_interval, *w_slog_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;
@@ -126,6 +125,14 @@ 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_slog_interval = GTK_SPIN_BUTTON
+               (gtk_builder_get_object(builder, "slog_interval"));
+       gtk_spin_button_set_value(w_slog_interval, cfg->slog_interval);
+
        w_hide_on_startup
                = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,
                                                           "hide_on_startup"));
@@ -143,14 +150,13 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
        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,
@@ -210,12 +216,18 @@ 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->slog_interval
+                       = gtk_spin_button_get_value_as_int(w_slog_interval);
+
                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);
        }