[calls] main-window: Make it a HdyApplicationWindow



commit f4f41d9db5af3999a99d5c00ad33c0353fe693f9
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Jul 15 09:35:32 2021 +0200

    main-window: Make it a HdyApplicationWindow
    
    This gives the window some nice rounded corners, and gives us more
    freedom in how to implement the UI.
    
    This purposefully leaves the indentation broken to ease code review, it
    will be fixed in the next commit.

 src/calls-main-window.c |  4 ++--
 src/calls-main-window.h |  4 ++--
 src/ui/main-window.ui   | 38 ++++++++++++++++++++++----------------
 3 files changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/src/calls-main-window.c b/src/calls-main-window.c
index 57c3fd35..b764547a 100644
--- a/src/calls-main-window.c
+++ b/src/calls-main-window.c
@@ -42,7 +42,7 @@
 
 struct _CallsMainWindow
 {
-  GtkApplicationWindow parent_instance;
+  HdyApplicationWindow parent_instance;
 
   GListModel *record_store;
 
@@ -67,7 +67,7 @@ struct _CallsMainWindow
   GtkButton  *ussd_reply_button;
 };
 
-G_DEFINE_TYPE (CallsMainWindow, calls_main_window, GTK_TYPE_APPLICATION_WINDOW);
+G_DEFINE_TYPE (CallsMainWindow, calls_main_window, HDY_TYPE_APPLICATION_WINDOW);
 
 enum {
   PROP_0,
diff --git a/src/calls-main-window.h b/src/calls-main-window.h
index 26277044..a058ff48 100644
--- a/src/calls-main-window.h
+++ b/src/calls-main-window.h
@@ -25,13 +25,13 @@
 #ifndef CALLS_MAIN_WINDOW_H__
 #define CALLS_MAIN_WINDOW_H__
 
-#include <gtk/gtk.h>
+#include <handy.h>
 
 G_BEGIN_DECLS
 
 #define CALLS_TYPE_MAIN_WINDOW (calls_main_window_get_type ())
 
-G_DECLARE_FINAL_TYPE (CallsMainWindow, calls_main_window, CALLS, MAIN_WINDOW, GtkApplicationWindow);
+G_DECLARE_FINAL_TYPE (CallsMainWindow, calls_main_window, CALLS, MAIN_WINDOW, HdyApplicationWindow);
 
 CallsMainWindow *calls_main_window_new  (GtkApplication  *application,
                                          GListModel      *record_store);
diff --git a/src/ui/main-window.ui b/src/ui/main-window.ui
index c6393aac..d2fcf377 100644
--- a/src/ui/main-window.ui
+++ b/src/ui/main-window.ui
@@ -3,12 +3,33 @@
 <interface>
   <requires lib="gtk+" version="3.20"/>
   <requires lib="libhandy" version="1.0"/>
-  <template class="CallsMainWindow" parent="GtkApplicationWindow">
+  <template class="CallsMainWindow" parent="HdyApplicationWindow">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Calls</property>
     <property name="hide_titlebar_when_maximized">True</property>
     <property name="show_menubar">False</property>
     <signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="HdyHeaderBar">
+            <property name="visible">True</property>
+            <property name="centering_policy">strict</property>
+            <property name="can_focus">False</property>
+            <property name="show_close_button">True</property>
+            <property name="title" bind-source="CallsMainWindow" bind-property="title" 
bind-flags="sync-create"/>
+            <child type="title">
+              <object class="HdyViewSwitcherTitle" id="title_switcher">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="stack">main_stack</property>
+                <property name="title" bind-source="CallsMainWindow" bind-property="title" 
bind-flags="sync-create"/>
+              </object>
+            </child>
+          </object>
+        </child>
     <child>
       <object class="GtkOverlay">
         <property name="visible">True</property>
@@ -63,21 +84,6 @@
         </child>
       </object>
     </child>
-    <child type="titlebar">
-      <object class="HdyHeaderBar">
-        <property name="visible">True</property>
-        <property name="centering_policy">strict</property>
-        <property name="can_focus">False</property>
-        <property name="show_close_button">True</property>
-        <property name="title" bind-source="CallsMainWindow" bind-property="title" bind-flags="sync-create"/>
-        <child type="title">
-          <object class="HdyViewSwitcherTitle" id="title_switcher">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="stack">main_stack</property>
-            <property name="title" bind-source="CallsMainWindow" bind-property="title" 
bind-flags="sync-create"/>
-          </object>
-        </child>
       </object>
     </child>
   </template>


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