From 2effb243dfdee567a486a34ab0e51d40e953310a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 19 Aug 2014 22:13:45 -0500 Subject: initial pass at 'hello world' src + po --- po/CMakeLists.txt | 3 +++ po/POTFILES.in | 1 + src/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ src/main.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/rotation-lock.cpp | 19 +++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 po/CMakeLists.txt create mode 100644 po/POTFILES.in create mode 100644 src/CMakeLists.txt create mode 100644 src/main.cpp create mode 100644 src/rotation-lock.cpp diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..8325f6e --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,3 @@ +include (Translations) +add_translations_directory ("${GETTEXT_PACKAGE}") +add_translations_catalog ("${GETTEXT_PACKAGE}" ../src/) diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..f8bd80a --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1 @@ +src/rotation-lock.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..9f52922 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,35 @@ +set (SERVICE_LIB "indicatordisplayservice") +set (SERVICE_EXEC "indicator-display-service") + +add_definitions (-DG_LOG_DOMAIN="${CMAKE_PROJECT_NAME}") + +# handwritten source code... +set (SERVICE_LIB_HANDWRITTEN_SOURCES + rotation-lock.cpp + #controller.cpp + #model.cpp + #display.cpp + #view.cpp + #view-gmenu.cpp + #world.cpp + #world-dbus.cpp) + +add_library (${SERVICE_LIB} STATIC + ${SERVICE_LIB_HANDWRITTEN_SOURCES}) + +# add the bin dir to the include path so that +# the compiler can find the generated header files +include_directories (${CMAKE_CURRENT_BINARY_DIR}) + +link_directories (${SERVICE_DEPS_LIBRARY_DIRS}) + +set (SERVICE_EXEC_HANDWRITTEN_SOURCES main.cpp) +add_executable (${SERVICE_EXEC} ${SERVICE_EXEC_HANDWRITTEN_SOURCES}) +target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES} ${GCOV_LIBS}) +install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}) + +# add warnings/coverage info on handwritten files +# but not the generated ones... +set_property (SOURCE ${SERVICE_LIB_HANDWRITTEN_SOURCES} ${SERVICE_EXEC_HANDWRITTEN_SOURCES} + APPEND_STRING PROPERTY COMPILE_FLAGS " -std=c++11 -g ${CXX_WARNING_ARGS} ${GCOV_FLAGS}") + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f3b5392 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,50 @@ +/* + * Copyright 2014 Canonical Ltd. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + * + * Authors: + * Charles Kerr + */ + +#include // bindtextdomain() +#include + +#include + +int +main(int /*argc*/, char** /*argv*/) +{ + // Work around a deadlock in glib's type initialization. + // It can be removed when https://bugzilla.gnome.org/show_bug.cgi?id=674885 is fixed. + g_type_ensure(G_TYPE_DBUS_CONNECTION); + + // boilerplate i18n + setlocale(LC_ALL, ""); + bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR); + textdomain(GETTEXT_PACKAGE); + + auto loop = g_main_loop_new(nullptr, false); + + // run until we lose the busname +// auto model = std::make_shared(); + // auto world = std::shared_ptr(new DBusWorld(model)); + // auto controller = std::make_shared(model, world); + // GMenuView menu_view (model, controller); + // FIXME: listen for busname-lost + g_main_loop_run(loop); + + // cleanup + g_main_loop_unref(loop); + return 0; +} diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp new file mode 100644 index 0000000..0a80085 --- /dev/null +++ b/src/rotation-lock.cpp @@ -0,0 +1,19 @@ +/* + * Copyright 2014 Canonical Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Authors: + * Charles Kerr + */ + -- cgit v1.2.3