[gnome-builder] meson-templates: simplified template with logical operators



commit 5fadd93e42b477bf28b6e00ce9521ffe1757d267
Author: Günther Wagner <info gunibert de>
Date:   Sun Jul 18 20:52:53 2021 +0200

    meson-templates: simplified template with logical operators

 src/plugins/meson-templates/resources/src/window.cpp | 4 ++--
 src/plugins/meson-templates/resources/src/window.ui  | 8 ++------
 2 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/meson-templates/resources/src/window.cpp 
b/src/plugins/meson-templates/resources/src/window.cpp
index 0df2b047c..9092bd6ae 100644
--- a/src/plugins/meson-templates/resources/src/window.cpp
+++ b/src/plugins/meson-templates/resources/src/window.cpp
@@ -26,10 +26,10 @@ std::unique_ptr<{{Prefix}}Window> {{Prefix}}Window::create()
        // Get ApplicationWindow that is specified in the UI file but
        // implemented in our code. So our ApplicationWindow is derived.
        {{Prefix}}Window* window = nullptr;
-       builder->get_widget_derived("appwindow", window);
+       builder->get_widget_derived("window", window);
 
        if (!window)
-               throw std::runtime_error("No \"appwindow\" object {{ui_file}}");
+               throw std::runtime_error("No \"window\" object {{ui_file}}");
 
        return std::unique_ptr<{{Prefix}}Window>(window);
 }
diff --git a/src/plugins/meson-templates/resources/src/window.ui 
b/src/plugins/meson-templates/resources/src/window.ui
index b48da7d78..7d5861d5f 100644
--- a/src/plugins/meson-templates/resources/src/window.ui
+++ b/src/plugins/meson-templates/resources/src/window.ui
@@ -1,10 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="3.24"/>
-  {{if language == "rust"}}
+  {{if (language == "rust") || (language == "c++")}}
   <object class="GtkApplicationWindow" id="window">
-  {{else if language == "c++"}}
-  <object class="GtkApplicationWindow" id="appwindow">
   {{else}}
   <template class="{{PreFix}}Window" parent="GtkApplicationWindow">
   {{end}}
@@ -31,9 +29,7 @@
         </attributes>
       </object>
     </child>
-  {{if language == "rust"}}
-  </object>
-  {{else if language == "c++"}}
+  {{if (language == "rust") || (language == "c++")}}
   </object>
   {{else}}
   </template>


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