From 26daf744bbfa9f960e9f790a77c8f8bdd0df268d Mon Sep 17 00:00:00 2001
From: Michael Carlberg <c@rlberg.se>
Date: Mon, 27 Jun 2016 21:52:21 +0200
Subject: [PATCH] fix: Conditional modules

---
 include/config.hpp.cmake |  8 ++++----
 src/bar.cpp              | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/include/config.hpp.cmake b/include/config.hpp.cmake
index 2fd4432d..acea5c39 100644
--- a/include/config.hpp.cmake
+++ b/include/config.hpp.cmake
@@ -2,10 +2,10 @@
 
 #define APP_NAME "@PROJECT_NAME@"
 
-#cmakedefine ENABLE_ALSA true
-#cmakedefine ENABLE_MPD true
-#cmakedefine ENABLE_NETWORK true
-#cmakedefine ENABLE_I3 true
+#cmakedefine01 ENABLE_ALSA
+#cmakedefine01 ENABLE_MPD
+#cmakedefine01 ENABLE_NETWORK
+#cmakedefine01 ENABLE_I3
 
 #define BUILDER_SPACE_TOKEN "%__"
 #define ALSA_SOUNDCARD "@SETTING_ALSA_SOUNDCARD@"
diff --git a/src/bar.cpp b/src/bar.cpp
index 0c5192f5..1b12330c 100644
--- a/src/bar.cpp
+++ b/src/bar.cpp
@@ -14,16 +14,16 @@
 #include "modules/menu.hpp"
 #include "modules/script.hpp"
 #include "modules/text.hpp"
-#ifdef ENABLE_I3
+#if ENABLE_I3
 #include "modules/i3.hpp"
 #endif
-#ifdef ENABLE_MPD
+#if ENABLE_MPD
 #include "modules/mpd.hpp"
 #endif
-#ifdef ENABLE_NETWORK
+#if ENABLE_NETWORK
 #include "modules/network.hpp"
 #endif
-#ifdef ENABLE_ALSA
+#if ENABLE_ALSA
 #include "modules/volume.hpp"
 #endif
 
@@ -156,10 +156,18 @@ void Bar::load()
       else if (type == "internal/cpu") module = std::make_unique<modules::CpuModule>(mod);
       else if (type == "internal/date") module = std::make_unique<modules::DateModule>(mod);
       else if (type == "internal/memory") module = std::make_unique<modules::MemoryModule>(mod);
+      #if ENABLE_I3
       else if (type == "internal/i3") module = std::make_unique<modules::i3Module>(mod, this->opts->monitor->name);
+      #endif
+      #if ENABLE_MPD
       else if (type == "internal/mpd") module = std::make_unique<modules::MpdModule>(mod);
+      #endif
+      #if ENABLE_ALSA
       else if (type == "internal/volume") module = std::make_unique<modules::VolumeModule>(mod);
+      #endif
+      #if ENABLE_NETWORK
       else if (type == "internal/network") module = std::make_unique<modules::NetworkModule>(mod);
+      #endif
       else if (type == "custom/text") module = std::make_unique<modules::TextModule>(mod);
       else if (type == "custom/script") module = std::make_unique<modules::ScriptModule>(mod);
       else if (type == "custom/menu") module = std::make_unique<modules::MenuModule>(mod);