[sysprof/wip/gtk4-port: 89/125] sysprof: introduce libadwaita




commit 305c62a34c757bf01dfd98d59c784cd4264bc9fa
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 1 13:09:23 2021 -0700

    sysprof: introduce libadwaita

 src/sysprof/meson.build           |  1 +
 src/sysprof/sysprof-application.c |  4 +-
 src/sysprof/sysprof-application.h |  4 +-
 src/sysprof/sysprof-window.c      |  4 +-
 src/sysprof/sysprof-window.h      |  4 +-
 src/sysprof/sysprof-window.ui     | 83 +++++++++++++++++++++------------------
 6 files changed, 55 insertions(+), 45 deletions(-)
---
diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build
index 96552a26..81bcde7c 100644
--- a/src/sysprof/meson.build
+++ b/src/sysprof/meson.build
@@ -18,6 +18,7 @@ sysprof_deps = [
   libsysprof_dep,
   libsysprof_ui_dep,
   dependency('pangoft2', required: false),
+  dependency('libadwaita-1'),
 ]
 
 sysprof = executable('sysprof', sysprof_resources + sysprof_sources,
diff --git a/src/sysprof/sysprof-application.c b/src/sysprof/sysprof-application.c
index f30bc82f..22b0b16b 100644
--- a/src/sysprof/sysprof-application.c
+++ b/src/sysprof/sysprof-application.c
@@ -27,10 +27,10 @@
 
 struct _SysprofApplication
 {
-  GtkApplication parent_instance;
+  AdwApplication parent_instance;
 };
 
-G_DEFINE_TYPE (SysprofApplication, sysprof_application, GTK_TYPE_APPLICATION)
+G_DEFINE_TYPE (SysprofApplication, sysprof_application, ADW_TYPE_APPLICATION)
 
 struct {
   const gchar *action_name;
diff --git a/src/sysprof/sysprof-application.h b/src/sysprof/sysprof-application.h
index dfcef56a..4c825395 100644
--- a/src/sysprof/sysprof-application.h
+++ b/src/sysprof/sysprof-application.h
@@ -18,13 +18,13 @@
 
 #pragma once
 
-#include <gtk/gtk.h>
+#include <adwaita.h>
 
 G_BEGIN_DECLS
 
 #define SYSPROF_TYPE_APPLICATION (sysprof_application_get_type())
 
-G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, GtkApplication)
+G_DECLARE_FINAL_TYPE (SysprofApplication, sysprof_application, SYSPROF, APPLICATION, AdwApplication)
 
 SysprofApplication *sysprof_application_new (void);
 
diff --git a/src/sysprof/sysprof-window.c b/src/sysprof/sysprof-window.c
index 5f66ca12..0cf65524 100644
--- a/src/sysprof/sysprof-window.c
+++ b/src/sysprof/sysprof-window.c
@@ -31,7 +31,7 @@
 
 struct _SysprofWindow
 {
-  GtkApplicationWindow  parent_instance;
+  AdwApplicationWindow  parent_instance;
 
   EggBindingGroup      *bindings;
 
@@ -40,7 +40,7 @@ struct _SysprofWindow
   GtkMenuButton        *menu_button;
 };
 
-G_DEFINE_TYPE (SysprofWindow, sysprof_window, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (SysprofWindow, sysprof_window, ADW_TYPE_APPLICATION_WINDOW)
 
 /**
  * sysprof_window_new:
diff --git a/src/sysprof/sysprof-window.h b/src/sysprof/sysprof-window.h
index 1def9343..e0ca3ce5 100644
--- a/src/sysprof/sysprof-window.h
+++ b/src/sysprof/sysprof-window.h
@@ -20,13 +20,15 @@
 
 #pragma once
 
+#include <adwaita.h>
+
 #include "sysprof-application.h"
 
 G_BEGIN_DECLS
 
 #define SYSPROF_TYPE_WINDOW (sysprof_window_get_type())
 
-G_DECLARE_FINAL_TYPE (SysprofWindow, sysprof_window, SYSPROF, WINDOW, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (SysprofWindow, sysprof_window, SYSPROF, WINDOW, AdwApplicationWindow)
 
 GtkWidget *sysprof_window_new              (SysprofApplication *application);
 void       sysprof_window_new_tab          (SysprofWindow      *self);
diff --git a/src/sysprof/sysprof-window.ui b/src/sysprof/sysprof-window.ui
index 01fab152..3cad5f4d 100644
--- a/src/sysprof/sysprof-window.ui
+++ b/src/sysprof/sysprof-window.ui
@@ -1,54 +1,61 @@
 <?xml version="1.0" encoding="utf-8"?>
 <interface>
-  <template class="SysprofWindow" parent="GtkApplicationWindow">
+  <template class="SysprofWindow" parent="AdwApplicationWindow">
+    <style>
+      <class name="org-gnome-Sysprof"/>
+    </style>
     <property name="default-height">750</property>
     <property name="icon-name">org.gnome.Sysprof-symbolic</property>
-    <property name="show-menubar">false</property>
     <property name="title" translatable="yes">Sysprof</property>
-    <child type="titlebar">
-      <object class="GtkHeaderBar">
-        <property name="show-title-buttons">true</property>
-        <property name="visible">true</property>
-        <child type="end">
-          <object class="GtkMenuButton" id="menu_button">
+    <child>
+      <object class="GtkBox">
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkHeaderBar">
+            <property name="show-title-buttons">true</property>
             <property name="visible">true</property>
-            <child>
-              <object class="GtkImage">
-                <property name="icon-name">open-menu-symbolic</property>
+            <child type="end">
+              <object class="GtkMenuButton" id="menu_button">
                 <property name="visible">true</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="icon-name">open-menu-symbolic</property>
+                    <property name="visible">true</property>
+                  </object>
+                </child>
+                <style>
+                  <class name="image-button"/>
+                </style>
+              </object>
+            </child>
+            <child type="start">
+              <object class="GtkButton" id="open_button">
+                <property name="label" translatable="yes">_Open</property>
+                <property name="action-name">app.open-capture</property>
+                <property name="use-underline">true</property>
+                <property name="tooltip-text" translatable="yes">Open Recording… (Ctrl+O)</property>
+                <property name="visible">true</property>
+              </object>
+            </child>
+            <child type="end">
+              <object class="GtkLabel" id="stat_label">
+                <property name="margin-end">12</property>
+                <property name="xalign">1</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
               </object>
             </child>
-            <style>
-              <class name="image-button"/>
-            </style>
-          </object>
-        </child>
-        <child type="start">
-          <object class="GtkButton" id="open_button">
-            <property name="label" translatable="yes">_Open</property>
-            <property name="action-name">app.open-capture</property>
-            <property name="use-underline">true</property>
-            <property name="tooltip-text" translatable="yes">Open Recording… (Ctrl+O)</property>
-            <property name="visible">true</property>
-          </object>
-        </child>
-        <child type="end">
-          <object class="GtkLabel" id="stat_label">
-            <property name="margin-end">12</property>
-            <property name="xalign">1</property>
-            <style>
-              <class name="dim-label"/>
-            </style>
           </object>
         </child>
-      </object>
-    </child>
-    <child>
-      <object class="SysprofNotebook" id="notebook">
-        <property name="visible">true</property>
         <child>
-          <object class="SysprofDisplay">
+          <object class="SysprofNotebook" id="notebook">
             <property name="visible">true</property>
+            <child>
+              <object class="SysprofDisplay">
+                <property name="visible">true</property>
+              </object>
+            </child>
           </object>
         </child>
       </object>


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