From 0a85bb794df73906da2905c72e305e556e717a79 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 28 Apr 2025 22:37:46 +0200 Subject: demo: rename to hello-world example --- CMakeLists.txt | 2 +- demo/CMakeLists.txt | 7 ------- demo/src/main.cpp | 18 ------------------ examples/hello-world/CMakeLists.txt | 7 +++++++ examples/hello-world/hello.cpp | 15 +++++++++++++++ 5 files changed, 23 insertions(+), 26 deletions(-) delete mode 100644 demo/CMakeLists.txt delete mode 100644 demo/src/main.cpp create mode 100644 examples/hello-world/CMakeLists.txt create mode 100644 examples/hello-world/hello.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d7246c..19513e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,4 +68,4 @@ install(TARGETS "adwaitamm" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -add_subdirectory("demo") \ No newline at end of file +add_subdirectory("examples/hello-world") \ No newline at end of file diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt deleted file mode 100644 index ce0f2d6..0000000 --- a/demo/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable("demo" - "src/main.cpp" -) - -target_link_libraries("demo" PRIVATE - "adwaitamm::adwaitamm" -) \ No newline at end of file diff --git a/demo/src/main.cpp b/demo/src/main.cpp deleted file mode 100644 index bb8a991..0000000 --- a/demo/src/main.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#include -#include - -auto main(int argc, char ** argv) -> int -{ - auto app = Adwaita::Application::create("ch.arknet.libadwaitamm.demo", Gtk::Application::Flags::NON_UNIQUE); - - app->signal_startup().connect([app] { - auto window = new Adwaita::ApplicationWindow{*app}; - window->present(); - - app->signal_shutdown().connect([window] { delete window; }); - }); - - return app->run(argc, argv); -} \ No newline at end of file diff --git a/examples/hello-world/CMakeLists.txt b/examples/hello-world/CMakeLists.txt new file mode 100644 index 0000000..8ad13e3 --- /dev/null +++ b/examples/hello-world/CMakeLists.txt @@ -0,0 +1,7 @@ +add_executable("hello" + "hello.cpp" +) + +target_link_libraries("hello" PRIVATE + "adwaitamm::adwaitamm" +) \ No newline at end of file diff --git a/examples/hello-world/hello.cpp b/examples/hello-world/hello.cpp new file mode 100644 index 0000000..ddcbc7a --- /dev/null +++ b/examples/hello-world/hello.cpp @@ -0,0 +1,15 @@ +#include + +auto main(int argc, char ** argv) -> int +{ + auto app = Adwaita::Application::create("org.example.Hello"); + + app->signal_activate().connect([app] { + auto window = new Adwaita::ApplicationWindow{*app}; + app->signal_shutdown().connect([window] { delete window; }); + + window->present(); + }); + + return app->run(argc, argv); +} -- cgit v1.2.3