Browse Source

Moved Ubuntu check to CMakeLists.txt.

merge-requests/365/head
eidheim 10 years ago
parent
commit
d055a1104d
  1. 11
      src/CMakeLists.txt
  2. 18
      src/menu.cc

11
src/CMakeLists.txt

@ -10,6 +10,17 @@ if(APPLE)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig")
endif()
if(UNIX) #Checking if compiling on Ubuntu that has a buggy menu system
find_program(LSB_RELEASE_BIN lsb_release)
if(LSB_RELEASE_BIN)
execute_process(COMMAND ${LSB_RELEASE_BIN} -is
OUTPUT_VARIABLE DISTRIBUTION OUTPUT_STRIP_TRAILING_WHITESPACE)
if(DISTRIBUTION STREQUAL Ubuntu)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUBUNTU_BUGGED_MENU")
endif()
endif()
endif()
INCLUDE(FindPkgConfig)
find_package(LibClang REQUIRED)

18
src/menu.cc

@ -10,21 +10,9 @@ Menu::Menu() {
//TODO: if Ubuntu ever gets fixed, move to constructor, also cleanup the rest of the Ubuntu specific code
void Menu::init() {
bool ubuntu_bugged_menu_system=false; //TODO: move to CMakeLists.txt and set -DUBUNTU_BUGGED_MENU
#ifdef __linux
if(boost::filesystem::exists("/usr/bin/lsb_release")) {
std::stringstream stdin_stream, stdout_stream;
Singleton::terminal()->execute(stdin_stream, stdout_stream, "lsb_release -is");
if(stdout_stream.str()=="Ubuntu\n")
ubuntu_bugged_menu_system=true;
}
#else
ubuntu_bugged_menu_system=false;
#endif
auto accels=Singleton::Config::menu()->keys;
for(auto &accel: accels) {
if(ubuntu_bugged_menu_system) {
#ifdef UBUNTU_BUGGED_MENU
size_t pos=0;
std::string second=accel.second;
while((pos=second.find('<', pos))!=std::string::npos) {
@ -40,9 +28,9 @@ void Menu::init() {
accel.second="<attribute name='accel'>"+second+"</attribute>";
else
accel.second="";
}
else
#else
accel.second="";
#endif
}
ui_xml =

Loading…
Cancel
Save