[gnome-builder] Use C++14 std::make_unique<> to instantiate Gtk::Window object
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] Use C++14 std::make_unique<> to instantiate Gtk::Window object
- Date: Fri, 4 Sep 2020 02:08:19 +0000 (UTC)
commit e8c28289b6197fe32e36031e07c9f8e0d516977a
Author: Keyikedalube Ndang <keyikedalubendang protonmail ch>
Date: Fri Sep 4 07:22:53 2020 +0530
Use C++14 std::make_unique<> to instantiate Gtk::Window object
src/plugins/meson-templates/resources/src/main.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/meson-templates/resources/src/main.cpp
b/src/plugins/meson-templates/resources/src/main.cpp
index f8ae8aed6..f17ff4d89 100644
--- a/src/plugins/meson-templates/resources/src/main.cpp
+++ b/src/plugins/meson-templates/resources/src/main.cpp
@@ -1,15 +1,16 @@
{{include "license.cpp"}}
#include "{{prefix}}-window.h"
+#include <memory>
static void
on_activate (Glib::RefPtr<Gtk::Application> app)
{
// Get the current window. If there is not one, we will create it.
- Gtk::Window *window = app->get_active_window();
+ static std::unique_ptr<Gtk::Window> window;
if (!window) {
- window = new {{Prefix}}Window();
+ window = std::make_unique<{{Prefix}}Window>();
window->property_application() = app;
window->property_default_width() = 600;
window->property_default_height() = 300;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]