avoid cpp usage
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 24 Sep 2014 19:05:39 +0000 (21:05 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 24 Sep 2014 19:05:39 +0000 (21:05 +0200)
src/ui_sensorpref.c

index e71492c..ff93a02 100644 (file)
 
 #include <cfg.h>
 #include <temperature.h>
+#include <ui_appindicator.h>
 #include <ui_pref.h>
 #include <ui_sensorlist.h>
 #include <ui_sensorpref.h>
 #include <ui_color.h>
 
-#if defined(HAVE_APPINDICATOR)
-#include <ui_appindicator.h>
-#endif
 
 enum {
        COL_NAME = 0,
@@ -290,18 +288,21 @@ update_pref(struct sensor_pref *p, struct config *cfg, GtkBuilder *builder)
                (gtk_builder_get_object(builder, "indicator_label_checkbox"));
 
 
-#if !HAVE_APPINDICATOR
-       gtk_widget_set_sensitive(GTK_WIDGET(w_appindicator_label_enabled),
-                                FALSE);
-       gtk_widget_set_sensitive(GTK_WIDGET(w_appindicator_enabled), FALSE);
-       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_label_enabled),
-                                  TRUE);
-       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_enabled), TRUE);
-#else
-       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_label_enabled),
-                                  FALSE);
-       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_enabled), FALSE);
-#endif
+       if (is_appindicator_supported()) {
+               gtk_widget_set_has_tooltip
+                       (GTK_WIDGET(w_appindicator_label_enabled), FALSE);
+               gtk_widget_set_has_tooltip
+                       (GTK_WIDGET(w_appindicator_enabled), FALSE);
+       } else {
+               gtk_widget_set_sensitive
+                       (GTK_WIDGET(w_appindicator_label_enabled), FALSE);
+               gtk_widget_set_has_tooltip
+                       (GTK_WIDGET(w_appindicator_label_enabled), TRUE);
+               gtk_widget_set_sensitive
+                       (GTK_WIDGET(w_appindicator_enabled), FALSE);
+               gtk_widget_set_has_tooltip
+                       (GTK_WIDGET(w_appindicator_enabled), TRUE);
+       }
 
        gtk_toggle_button_set_active(w_alarm, p->alarm_enabled);
        gtk_spin_button_set_value(w_high_threshold, p->alarm_high_threshold);