[gnome-builder] meson-templates: fixed cpp template unique ptr and ui



commit 9e155eaf0011048ef30550ef268dbad7b2730d8e
Author: Günther Wagner <info gunibert de>
Date:   Sun Jul 18 19:11:45 2021 +0200

    meson-templates: fixed cpp template unique ptr and ui

 src/plugins/meson-templates/resources/src/main.cpp   | 4 ++--
 src/plugins/meson-templates/resources/src/window.cpp | 6 +++---
 src/plugins/meson-templates/resources/src/window.hpp | 4 ++--
 src/plugins/meson-templates/resources/src/window.ui  | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/meson-templates/resources/src/main.cpp 
b/src/plugins/meson-templates/resources/src/main.cpp
index 58f8e5b9b..bb81f7246 100644
--- a/src/plugins/meson-templates/resources/src/main.cpp
+++ b/src/plugins/meson-templates/resources/src/main.cpp
@@ -31,14 +31,14 @@ main (int argc, char *argv[])
                Gtk::Application::create("{{appid}}", Gio::APPLICATION_FLAGS_NONE);
 
        // We connect to the activate signal to create a window when the application
-       // has been lauched. Additionally, this signal notifies us when the user
+       // has been launched. Additionally, this signal notifies us when the user
        // tries to launch a "second instance" of the application. When they try
        // to do that, we'll just present any existing window.
        //
        // Bind the app object to be passed to the callback "on_activate"
        app->signal_activate().connect(sigc::bind(&on_activate, app));
 
-       // Run the application. This function will block until the applicaiton
+       // Run the application. This function will block until the application
        // exits. Upon return, we have our exit code to return to the shell. (This
        // is the code you see when you do `echo $?` after running a command in a
        // terminal.
diff --git a/src/plugins/meson-templates/resources/src/window.cpp 
b/src/plugins/meson-templates/resources/src/window.cpp
index 8ceedee1e..0df2b047c 100644
--- a/src/plugins/meson-templates/resources/src/window.cpp
+++ b/src/plugins/meson-templates/resources/src/window.cpp
@@ -18,7 +18,7 @@
        m_pLabel->set_angle(30);
 }
 
-{{Prefix}}Window* {{Prefix}}Window::create()
+std::unique_ptr<{{Prefix}}Window> {{Prefix}}Window::create()
 {
        // Parse a resource file containing a GtkBuilder UI definition.
        auto builder = Gtk::Builder::create_from_resource("{{appid_path}}/{{ui_file}}");
@@ -29,7 +29,7 @@
        builder->get_widget_derived("appwindow", window);
 
        if (!window)
-                       throw std::runtime_error("No \"appwindow\" object {{ui_file}}");
+               throw std::runtime_error("No \"appwindow\" object {{ui_file}}");
 
-       return window;
+       return std::unique_ptr<{{Prefix}}Window>(window);
 }
diff --git a/src/plugins/meson-templates/resources/src/window.hpp 
b/src/plugins/meson-templates/resources/src/window.hpp
index 28207f624..9315a3b62 100644
--- a/src/plugins/meson-templates/resources/src/window.hpp
+++ b/src/plugins/meson-templates/resources/src/window.hpp
@@ -14,9 +14,9 @@ public:
        // constructor of the class should look like this. You can read
        // more about it in the reference.
        {{Prefix}}Window(BaseObjectType* cobject,
-                       const Glib::RefPtr<Gtk::Builder>& refBuilder);
+                        const Glib::RefPtr<Gtk::Builder>& refBuilder);
 
-       static {{Prefix}}Window* create();
+       static std::unique_ptr<{{Prefix}}Window> create();
 private:
        Glib::RefPtr<Gtk::Builder> m_refBuilder;
        Gtk::Label* m_pLabel;
diff --git a/src/plugins/meson-templates/resources/src/window.ui 
b/src/plugins/meson-templates/resources/src/window.ui
index 9443efccb..b48da7d78 100644
--- a/src/plugins/meson-templates/resources/src/window.ui
+++ b/src/plugins/meson-templates/resources/src/window.ui
@@ -4,9 +4,10 @@
   {{if language == "rust"}}
   <object class="GtkApplicationWindow" id="window">
   {{else if language == "c++"}}
-       <object class="GtkApplicationWindow" id="appwindow">
+  <object class="GtkApplicationWindow" id="appwindow">
   {{else}}
   <template class="{{PreFix}}Window" parent="GtkApplicationWindow">
+  {{end}}
     <property name="default-width">600</property>
     <property name="default-height">300</property>
     <child type="titlebar">
@@ -37,5 +38,4 @@
   {{else}}
   </template>
   {{end}}
-{{end}}
 </interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]