X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_pref.c;h=27201adcecef3454cc12a561e1d767a53a8bf03c;hb=ae573ea0c5328662e711d7717edc835d1a313d58;hp=81dfe110cc8b6f38b7d381fc9eb2c6e5f4b0a270;hpb=08f8ffe30eede149c1b3b2b4ab638506060ea4a1;p=psensor.git diff --git a/src/ui_pref.c b/src/ui_pref.c index 81dfe11..27201ad 100644 --- a/src/ui_pref.c +++ b/src/ui_pref.c @@ -19,16 +19,25 @@ #include #include +#include #include -#include #include #include +#include #include #include #include #include -#include +#include #include +#include +#include + +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) { @@ -128,7 +137,7 @@ void ui_pref_dialog_run(struct ui_psensor *ui) 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")); @@ -148,13 +157,15 @@ void ui_pref_dialog_run(struct ui_psensor *ui) 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")); @@ -192,6 +203,13 @@ void ui_pref_dialog_run(struct ui_psensor *ui) "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")); @@ -240,12 +258,14 @@ void ui_pref_dialog_run(struct ui_psensor *ui) 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()); @@ -262,6 +282,8 @@ void ui_pref_dialog_run(struct ui_psensor *ui) 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) { @@ -296,9 +318,6 @@ void ui_pref_dialog_run(struct ui_psensor *ui) 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); @@ -309,9 +328,6 @@ void ui_pref_dialog_run(struct ui_psensor *ui) = !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);