#include <string.h>
#include <amd.h>
-#include <ui.h>
#include <cfg.h>
#include <graph.h>
+#include <hdd.h>
+#include <lmsensor.h>
#include <nvidia.h>
#include <pgtop2.h>
#include <pudisks2.h>
#include <pxdg.h>
-#include <ui_pref.h>
+#include <ui.h>
#include <ui_color.h>
+#include <ui_pref.h>
+#include <ui_unity.h>
+
+void ui_pref_decoration_toggled_cbk(GtkToggleButton *btn, gpointer data)
+{
+ config_set_window_decoration_enabled
+ (!config_is_window_decoration_enabled());
+}
GdkRGBA color_to_GdkRGBA(struct color *color)
{
w_hide_window_decoration = GTK_TOGGLE_BUTTON
(gtk_builder_get_object(builder, "hide_window_decoration"));
gtk_toggle_button_set_active(w_hide_window_decoration,
- !cfg->window_decoration_enabled);
+ !config_is_window_decoration_enabled());
w_keep_window_below = GTK_TOGGLE_BUTTON
(gtk_builder_get_object(builder, "keep_window_below"));
gtk_toggle_button_set_active(w_enable_launcher_counter,
!cfg->unity_launcher_count_disabled);
-#if !HAVE_UNITY
- gtk_widget_set_sensitive(GTK_WIDGET(w_enable_launcher_counter), FALSE);
- gtk_widget_set_has_tooltip(GTK_WIDGET(w_enable_launcher_counter), TRUE);
-#else
- gtk_widget_set_has_tooltip(GTK_WIDGET(w_enable_launcher_counter),
- FALSE);
-#endif
+ if (ui_unity_is_supported()) {
+ gtk_widget_set_has_tooltip
+ (GTK_WIDGET(w_enable_launcher_counter), FALSE);
+ } else {
+ gtk_widget_set_sensitive
+ (GTK_WIDGET(w_enable_launcher_counter), FALSE);
+ gtk_widget_set_has_tooltip
+ (GTK_WIDGET(w_enable_launcher_counter), TRUE);
+ }
w_smooth_curves = GTK_TOGGLE_BUTTON
(gtk_builder_get_object(builder, "graph_smooth_curves"));
"lmsensors"));
gtk_toggle_button_set_active(w_lmsensors, config_is_lmsensor_enabled());
+ if (lmsensor_is_supported()) {
+ gtk_widget_set_has_tooltip(GTK_WIDGET(w_lmsensors), FALSE);
+ } else {
+ gtk_widget_set_sensitive(GTK_WIDGET(w_lmsensors), 0);
+ gtk_widget_set_has_tooltip(GTK_WIDGET(w_lmsensors), TRUE);
+ }
+
w_nvctrl
= GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,
"nvctrl"));
w_libatasmart
= GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,
"libatasmart"));
-#if !HAVE_ATASMART
- gtk_widget_set_sensitive(GTK_WIDGET(w_libatasmart), 0);
- gtk_widget_set_has_tooltip(GTK_WIDGET(w_libatasmart), TRUE);
-#else
- gtk_widget_set_has_tooltip(GTK_WIDGET(w_libatasmart), FALSE);
-#endif
+
+ if (atasmart_is_supported()) {
+ gtk_widget_set_has_tooltip(GTK_WIDGET(w_libatasmart), FALSE);
+ } else {
+ gtk_widget_set_sensitive(GTK_WIDGET(w_libatasmart), 0);
+ gtk_widget_set_has_tooltip(GTK_WIDGET(w_libatasmart), TRUE);
+ }
+
gtk_toggle_button_set_active(w_libatasmart,
config_is_libatasmart_enabled());
gtk_toggle_button_set_active(w_udisks2, config_is_udisks2_enabled());
+ gtk_builder_connect_signals(builder, NULL);
+
result = gtk_dialog_run(diag);
if (result == GTK_RESPONSE_ACCEPT) {
cfg->sensorlist_position
= gtk_combo_box_get_active(w_sensorlist_pos);
- cfg->window_decoration_enabled =
- !gtk_toggle_button_get_active(w_hide_window_decoration);
-
cfg->window_keep_below_enabled
= gtk_toggle_button_get_active(w_keep_window_below);
= !gtk_toggle_button_get_active
(w_enable_launcher_counter);
- gtk_window_set_decorated(GTK_WINDOW(ui->main_window),
- cfg->window_decoration_enabled);
-
gtk_window_set_keep_below(GTK_WINDOW(ui->main_window),
cfg->window_keep_below_enabled);