X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_pref.c;h=1db60a5d755e5bf1a2844e976f27f2a261b00ac4;hb=28ba8deef53e8f46fa79919b9fea4fe2dc1163e4;hp=72322f441bb995b6f319809217219bf48b5d48fb;hpb=d96cb59ae7c70cd3306bc1a7e313b69cfcc10105;p=psensor.git diff --git a/src/ui_pref.c b/src/ui_pref.c index 72322f4..1db60a5 100644 --- a/src/ui_pref.c +++ b/src/ui_pref.c @@ -19,12 +19,25 @@ #include #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) { @@ -54,7 +67,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui) 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_slog_enabled, *w_autostart, *w_smooth_curves; + *w_win_restore, *w_slog_enabled, *w_autostart, *w_smooth_curves, + *w_atiadlsdk, *w_lmsensors, *w_nvctrl, *w_gtop2, *w_hddtemp, + *w_libatasmart, *w_udisks2; GtkComboBoxText *w_temp_unit; GtkEntry *w_notif_script; char *notif_script; @@ -122,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")); @@ -142,6 +157,16 @@ void ui_pref_dialog_run(struct ui_psensor *ui) gtk_toggle_button_set_active(w_enable_launcher_counter, !cfg->unity_launcher_count_disabled); + 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")); gtk_toggle_button_set_active(w_smooth_curves, @@ -172,6 +197,93 @@ void ui_pref_dialog_run(struct ui_psensor *ui) gtk_combo_box_set_active(GTK_COMBO_BOX(w_temp_unit), cfg->temperature_unit); + /* providers */ + w_lmsensors + = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, + "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")); + + if (nvidia_is_supported()) { + gtk_widget_set_has_tooltip(GTK_WIDGET(w_nvctrl), FALSE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(w_nvctrl), 0); + gtk_widget_set_has_tooltip(GTK_WIDGET(w_nvctrl), TRUE); + } + + gtk_toggle_button_set_active(w_nvctrl, config_is_nvctrl_enabled()); + + w_atiadlsdk + = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, + "atiadlsdk")); + if (amd_is_supported()) { + gtk_widget_set_has_tooltip(GTK_WIDGET(w_atiadlsdk), FALSE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(w_atiadlsdk), 0); + gtk_widget_set_has_tooltip(GTK_WIDGET(w_atiadlsdk), TRUE); + } + + gtk_toggle_button_set_active(w_atiadlsdk, + config_is_atiadlsdk_enabled()); + + w_gtop2 + = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, + "gtop2")); + + if (gtop2_is_supported()) { + gtk_widget_set_has_tooltip(GTK_WIDGET(w_gtop2), FALSE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(w_gtop2), 0); + gtk_widget_set_has_tooltip(GTK_WIDGET(w_gtop2), TRUE); + } + + gtk_toggle_button_set_active(w_gtop2, config_is_gtop2_enabled()); + + w_hddtemp + = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, + "hddtemp")); + gtk_toggle_button_set_active(w_hddtemp, config_is_hddtemp_enabled()); + + + w_libatasmart + = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, + "libatasmart")); + + 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()); + + w_udisks2 + = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, + "udisks2")); + + if (udisks2_is_supported()) { + gtk_widget_set_has_tooltip(GTK_WIDGET(w_udisks2), FALSE); + } else { + gtk_widget_set_sensitive(GTK_WIDGET(w_udisks2), 0); + gtk_widget_set_has_tooltip(GTK_WIDGET(w_udisks2), TRUE); + } + + 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) { @@ -206,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); @@ -219,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); @@ -257,6 +363,27 @@ void ui_pref_dialog_run(struct ui_psensor *ui) config_set_smooth_curves_enabled (gtk_toggle_button_get_active(w_smooth_curves)); + config_set_lmsensor_enable + (gtk_toggle_button_get_active(w_lmsensors)); + + config_set_nvctrl_enable + (gtk_toggle_button_get_active(w_nvctrl)); + + config_set_atiadlsdk_enable + (gtk_toggle_button_get_active(w_atiadlsdk)); + + config_set_gtop2_enable + (gtk_toggle_button_get_active(w_gtop2)); + + config_set_hddtemp_enable + (gtk_toggle_button_get_active(w_hddtemp)); + + config_set_libatasmart_enable + (gtk_toggle_button_get_active(w_libatasmart)); + + config_set_udisks2_enable + (gtk_toggle_button_get_active(w_udisks2)); + pxdg_set_autostart(gtk_toggle_button_get_active(w_autostart)); pthread_mutex_unlock(&ui->sensors_mutex);