[gnome-initial-setup/wip/port-to-gtk4: 95/110] Port core widgetry to GTK4




commit 2d39f98883ad4fcf43495582d46fa2669f35eac8
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 5 12:38:10 2022 -0300

    Port core widgetry to GTK4
    
    Replace libhandy by libadwaita. Make GisDriver inherit from
    AdwApplication instead of GtkApplication, which allows removing
    the adw_init() call.
    
    Replace the old GdkWindow checks for small screen by GTK4's
    GdkDisplay and GdkSurface checks.
    
    Make GisPage inherit from AdwBin instead of GtkBin, which is
    gone from GTK4.
    
    Add gis_assistant_remove_page() to help reimplementing the old
    behaviour that relied on (now non-existant) gtk_widget_destroy().
    
    Add libadwaita wrap file so that meson can build it as a submodule.

 gnome-initial-setup/gis-assistant.c       |  25 ++++---
 gnome-initial-setup/gis-assistant.h       |   2 +
 gnome-initial-setup/gis-assistant.ui      |  37 +++-------
 gnome-initial-setup/gis-driver.c          | 112 +++++++++---------------------
 gnome-initial-setup/gis-driver.h          |   3 +-
 gnome-initial-setup/gis-page-header.c     |   6 +-
 gnome-initial-setup/gis-page-header.ui    |   4 --
 gnome-initial-setup/gis-page.c            |   6 +-
 gnome-initial-setup/gis-page.h            |   6 +-
 gnome-initial-setup/gnome-initial-setup.c |  32 ++++++---
 gnome-initial-setup/meson.build           |  13 +++-
 subprojects/libadwaita.wrap               |   3 +
 12 files changed, 99 insertions(+), 150 deletions(-)
---
diff --git a/gnome-initial-setup/gis-assistant.c b/gnome-initial-setup/gis-assistant.c
index 8405357e..e17c9865 100644
--- a/gnome-initial-setup/gis-assistant.c
+++ b/gnome-initial-setup/gis-assistant.c
@@ -70,17 +70,6 @@ visible_child_changed (GisAssistant *assistant)
   g_signal_emit (assistant, signals[PAGE_CHANGED], 0);
 }
 
-static void
-widget_destroyed (GtkWidget    *widget,
-                  GisAssistant *assistant)
-{
-  GisPage *page = GIS_PAGE (widget);
-
-  assistant->pages = g_list_remove (assistant->pages, page);
-  if (page == assistant->current_page)
-    assistant->current_page = NULL;
-}
-
 static void
 switch_to (GisAssistant          *assistant,
            GisPage               *page)
@@ -307,10 +296,9 @@ gis_assistant_add_page (GisAssistant *assistant,
   link = g_list_last (assistant->pages);
   link = link->prev;
 
-  g_signal_connect (page, "destroy", G_CALLBACK (widget_destroyed), assistant);
   g_signal_connect (page, "notify", G_CALLBACK (page_notify), assistant);
 
-  gtk_container_add (GTK_CONTAINER (assistant->stack), GTK_WIDGET (page));
+  gtk_stack_add_child (GTK_STACK (assistant->stack), GTK_WIDGET (page));
 
   /* Update buttons if current page is now the second last page */
   if (assistant->current_page && link &&
@@ -318,6 +306,17 @@ gis_assistant_add_page (GisAssistant *assistant,
     update_navigation_buttons (assistant);
 }
 
+void
+gis_assistant_remove_page (GisAssistant *assistant,
+                           GisPage      *page)
+{
+  assistant->pages = g_list_remove (assistant->pages, page);
+  if (page == assistant->current_page)
+    assistant->current_page = NULL;
+
+  gtk_stack_remove (GTK_STACK (assistant->stack), GTK_WIDGET (page));
+}
+
 GisPage *
 gis_assistant_get_current_page (GisAssistant *assistant)
 {
diff --git a/gnome-initial-setup/gis-assistant.h b/gnome-initial-setup/gis-assistant.h
index 84adb63b..26218c15 100644
--- a/gnome-initial-setup/gis-assistant.h
+++ b/gnome-initial-setup/gis-assistant.h
@@ -31,6 +31,8 @@ G_DECLARE_FINAL_TYPE (GisAssistant, gis_assistant, GIS, ASSISTANT, GtkBox)
 
 void      gis_assistant_add_page          (GisAssistant *assistant,
                                            GisPage      *page);
+void      gis_assistant_remove_page       (GisAssistant *assistant,
+                                           GisPage      *page);
 
 void      gis_assistant_next_page         (GisAssistant *assistant);
 void      gis_assistant_previous_page     (GisAssistant *assistant);
diff --git a/gnome-initial-setup/gis-assistant.ui b/gnome-initial-setup/gis-assistant.ui
index 936f829f..08735f71 100644
--- a/gnome-initial-setup/gis-assistant.ui
+++ b/gnome-initial-setup/gis-assistant.ui
@@ -1,11 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface domain="gtk30">
-  <!-- interface-requires gtk+ 3.10 -->
   <object class="GtkHeaderBar" id="titlebar">
-    <property name="visible">True</property>
     <child type="title">
       <object class="GtkLabel" id="title">
-        <property name="visible">True</property>
         <attributes>
           <attribute name="weight" value="bold"/>
         </attributes>
@@ -13,60 +10,44 @@
     </child>
     <child>
       <object class="GtkButton" id="cancel">
-        <property name="visible">True</property>
         <property name="use-underline">True</property>
       </object>
     </child>
     <child>
       <object class="GtkButton" id="back">
-        <property name="visible">True</property>
         <property name="use-underline">True</property>
       </object>
     </child>
     <child>
       <object class="GtkLabel" id="placeholder">
-        <property name="visible">True</property>
       </object>
     </child>
-    <child>
-      <object class="GtkSpinner" id="spinner">
-        <property name="visible">True</property>
-      </object>
-      <packing>
-        <property name="pack-type">end</property>
-      </packing>
+    <child type="end">
+      <object class="GtkSpinner" id="spinner" />
     </child>
-    <child>
+    <child type="end">
       <object class="GtkButton" id="skip">
+        <property name="visible">False</property>
         <property name="use-underline">True</property>
       </object>
-      <packing>
-        <property name="pack-type">end</property>
-      </packing>
     </child>
-    <child>
+    <child type="end">
       <object class="GtkButton" id="forward">
+        <property name="visible">False</property>
         <property name="use-underline">True</property>
-        <property name="can-default">True</property>
         <style>
           <class name="suggested-action"/>
         </style>
       </object>
-      <packing>
-        <property name="pack-type">end</property>
-      </packing>
     </child>
-    <child>
+    <child type="end">
       <object class="GtkButton" id="accept">
+        <property name="visible">False</property>
         <property name="use-underline">True</property>
-        <property name="can-default">True</property>
         <style>
           <class name="suggested-action"/>
         </style>
       </object>
-      <packing>
-        <property name="pack-type">end</property>
-      </packing>
     </child>
   </object>
 
@@ -82,12 +63,10 @@
     <property name="orientation">vertical</property>
     <child>
       <object class="GtkBox" id="main_layout">
-        <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child>
           <object class="GtkStack" id="stack">
-            <property name="visible">True</property>
             <property name="transition-type">slide-left-right</property>
             <property name="vexpand">True</property>
             <property name="hexpand">True</property>
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index daf3a430..4d9c4b86 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -70,7 +70,7 @@ typedef enum {
 static GParamSpec *obj_props[PROP_AVATAR + 1];
 
 struct _GisDriver {
-  GtkApplication  parent_instance;
+  AdwApplication  parent_instance;
 
   GtkWindow *main_window;
   GisAssistant *assistant;
@@ -103,7 +103,7 @@ struct _GisDriver {
   GKeyFile *vendor_conf_file;
 };
 
-G_DEFINE_TYPE (GisDriver, gis_driver, GTK_TYPE_APPLICATION)
+G_DEFINE_TYPE (GisDriver, gis_driver, ADW_TYPE_APPLICATION)
 
 static void
 gis_driver_dispose (GObject *object)
@@ -155,12 +155,12 @@ prepare_main_window (GisDriver *driver)
 {
   GtkWidget *child, *sw;
 
-  child = g_object_ref (gtk_bin_get_child (GTK_BIN (driver->main_window)));
-  gtk_container_remove (GTK_CONTAINER (driver->main_window), child);
-  sw = gtk_scrolled_window_new (NULL, NULL);
-  gtk_widget_show (sw);
-  gtk_container_add (GTK_CONTAINER (driver->main_window), sw);
-  gtk_container_add (GTK_CONTAINER (sw), child);
+  child = gtk_window_get_child (GTK_WINDOW (driver->main_window));
+  g_object_ref (child);
+  gtk_window_set_child (GTK_WINDOW (driver->main_window), NULL);
+  sw = gtk_scrolled_window_new ();
+  gtk_window_set_child (GTK_WINDOW (driver->main_window), sw);
+  gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
   g_object_unref (child);
 
   g_signal_connect_swapped (driver->assistant,
@@ -677,41 +677,22 @@ gis_driver_activate (GApplication *app)
   gtk_window_present (GTK_WINDOW (driver->main_window));
 }
 
-static void
-set_small_screen_based_on_primary_monitor (GisDriver *driver)
-{
-  GdkDisplay *default_display;
-  GdkMonitor *primary_monitor;
-
-  default_display = gdk_display_get_default ();
-  if (default_display == NULL)
-    return;
-
-  primary_monitor = gdk_display_get_primary_monitor (default_display);
-  if (primary_monitor == NULL)
-    return;
-
-  driver->small_screen = monitor_is_small (primary_monitor);
-}
-
 /* Recompute driver->small_screen based on the monitor where the window is
  * located, if the window is actually realized. If not, recompute it based on
  * the primary monitor of the default display. */
 static void
-recompute_small_screen (GisDriver *driver) {
-  GdkWindow *window;
-  GdkDisplay *default_display = gdk_display_get_default ();
+recompute_small_screen (GisDriver *driver)
+{
   GdkMonitor *active_monitor;
   gboolean old_value = driver->small_screen;
 
-  if (!gtk_widget_get_realized (GTK_WIDGET (driver->main_window)))
-    {
-      set_small_screen_based_on_primary_monitor (driver);
-    }
-  else
+  if (gtk_widget_get_realized (GTK_WIDGET (driver->main_window)))
     {
-      window = gtk_widget_get_window (GTK_WIDGET (driver->main_window));
-      active_monitor = gdk_display_get_monitor_at_window (default_display, window);
+      GdkDisplay *default_display = gdk_display_get_default ();
+      GdkSurface *surface;
+
+      surface = gtk_native_get_surface (GTK_NATIVE (driver->main_window));
+      active_monitor = gdk_display_get_monitor_at_surface (default_display, surface);
       driver->small_screen = monitor_is_small (active_monitor);
     }
 
@@ -722,8 +703,6 @@ recompute_small_screen (GisDriver *driver) {
 static void
 update_screen_size (GisDriver *driver)
 {
-  GdkWindow *window;
-  GdkGeometry size_hints;
   GtkWidget *sw;
 
   recompute_small_screen (driver);
@@ -731,55 +710,34 @@ update_screen_size (GisDriver *driver)
   if (!gtk_widget_get_realized (GTK_WIDGET (driver->main_window)))
     return;
 
-  sw = gtk_bin_get_child (GTK_BIN (driver->main_window));
-  window = gtk_widget_get_window (GTK_WIDGET (driver->main_window));
+  sw = gtk_window_get_child (GTK_WINDOW (driver->main_window));
 
   if (driver->small_screen)
     {
-      if (window)
-        gdk_window_set_functions (window,
-                                  GDK_FUNC_ALL | GDK_FUNC_MINIMIZE | GDK_FUNC_CLOSE);
-
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-
-      gtk_window_set_geometry_hints (driver->main_window, NULL, NULL, 0);
+      gtk_window_set_default_size (driver->main_window, -1, -1);
       gtk_window_set_resizable (driver->main_window, TRUE);
-      gtk_window_set_position (driver->main_window, GTK_WIN_POS_NONE);
-
       gtk_window_maximize (driver->main_window);
       gtk_window_present (driver->main_window);
     }
   else
     {
-      if (window)
-        gdk_window_set_functions (window,
-                                  GDK_FUNC_ALL | GDK_FUNC_MINIMIZE | GDK_FUNC_CLOSE |
-                                  GDK_FUNC_RESIZE | GDK_FUNC_MOVE | GDK_FUNC_MAXIMIZE);
-
       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                       GTK_POLICY_NEVER,
                                       GTK_POLICY_NEVER);
-
-      size_hints.min_width = size_hints.max_width = 1024;
-      size_hints.min_height = size_hints.max_height = 768;
-      size_hints.win_gravity = GDK_GRAVITY_CENTER;
-
-      gtk_window_set_geometry_hints (driver->main_window,
-                                     NULL,
-                                     &size_hints,
-                                     GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_WIN_GRAVITY);
+      gtk_window_set_default_size (driver->main_window, 1024, 768);
       gtk_window_set_resizable (driver->main_window, FALSE);
-      gtk_window_set_position (driver->main_window, GTK_WIN_POS_CENTER_ALWAYS);
-
       gtk_window_unmaximize (driver->main_window);
       gtk_window_present (driver->main_window);
     }
 }
 
 static void
-screen_size_changed (GdkScreen *screen, GisDriver *driver)
+on_surface_enter_monitor_cb (GdkSurface *surface,
+                             GdkMonitor *monitor,
+                             GisDriver  *driver)
 {
   update_screen_size (driver);
 }
@@ -787,7 +745,15 @@ screen_size_changed (GdkScreen *screen, GisDriver *driver)
 static void
 window_realize_cb (GtkWidget *widget, gpointer user_data)
 {
-  update_screen_size (GIS_DRIVER (user_data));
+  GdkSurface *surface;
+  GisDriver *driver;
+
+  driver = GIS_DRIVER (user_data);
+
+  surface = gtk_native_get_surface (GTK_NATIVE (widget));
+  g_signal_connect (surface, "enter-monitor", G_CALLBACK (on_surface_enter_monitor_cb), driver);
+
+  update_screen_size (driver);
 }
 
 static void
@@ -824,7 +790,6 @@ gis_driver_startup (GApplication *app)
 
   driver->main_window = g_object_new (GTK_TYPE_APPLICATION_WINDOW,
                                     "application", app,
-                                    "type", GTK_WINDOW_TOPLEVEL,
                                     "icon-name", "preferences-system",
                                     "deletable", FALSE,
                                     NULL);
@@ -835,9 +800,8 @@ gis_driver_startup (GApplication *app)
                     (gpointer)app);
 
   driver->assistant = g_object_new (GIS_TYPE_ASSISTANT, NULL);
-  gtk_container_add (GTK_CONTAINER (driver->main_window), GTK_WIDGET (driver->assistant));
-
-  gtk_widget_show (GTK_WIDGET (driver->assistant));
+  gtk_window_set_child (GTK_WINDOW (driver->main_window),
+                        GTK_WIDGET (driver->assistant));
 
   gis_driver_set_user_language (driver, setlocale (LC_MESSAGES, NULL), FALSE);
 
@@ -848,17 +812,7 @@ gis_driver_startup (GApplication *app)
 static void
 gis_driver_init (GisDriver *driver)
 {
-  GdkScreen *screen;
-
-  screen = gdk_screen_get_default ();
-
-  set_small_screen_based_on_primary_monitor (driver);
-
   load_vendor_conf_file (driver);
-
-  if (screen != NULL)
-    g_signal_connect (screen, "size-changed",
-                      G_CALLBACK (screen_size_changed), driver);
 }
 
 static void
diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h
index 467b419e..3af51a8f 100644
--- a/gnome-initial-setup/gis-driver.h
+++ b/gnome-initial-setup/gis-driver.h
@@ -26,12 +26,13 @@
 #include "gis-page.h"
 #include <act/act-user-manager.h>
 #include <gdm/gdm-client.h>
+#include <adwaita.h>
 
 G_BEGIN_DECLS
 
 #define GIS_TYPE_DRIVER (gis_driver_get_type ())
 
-G_DECLARE_FINAL_TYPE (GisDriver, gis_driver, GIS, DRIVER, GtkApplication)
+G_DECLARE_FINAL_TYPE (GisDriver, gis_driver, GIS, DRIVER, AdwApplication)
 
 typedef enum {
   UM_LOCAL,
diff --git a/gnome-initial-setup/gis-page-header.c b/gnome-initial-setup/gis-page-header.c
index 8da1ee44..3cea4fde 100644
--- a/gnome-initial-setup/gis-page-header.c
+++ b/gnome-initial-setup/gis-page-header.c
@@ -197,7 +197,7 @@ gis_page_header_class_init (GisPageHeaderClass *klass)
 
   g_autoptr(GtkCssProvider) provider = gtk_css_provider_new ();
   gtk_css_provider_load_from_resource (provider, "/org/gnome/initial-setup/gis-page-header.css");
-  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
-                                             GTK_STYLE_PROVIDER (provider),
-                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+                                              GTK_STYLE_PROVIDER (provider),
+                                              GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
 }
diff --git a/gnome-initial-setup/gis-page-header.ui b/gnome-initial-setup/gis-page-header.ui
index e5e17958..215c1220 100644
--- a/gnome-initial-setup/gis-page-header.ui
+++ b/gnome-initial-setup/gis-page-header.ui
@@ -1,12 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface domain="gtk30">
-  <!-- interface-requires gtk+ 3.10 -->
   <template class="GisPageHeader" parent="GtkBox">
     <property name="orientation">vertical</property>
     <property name="spacing">18</property>
     <child>
       <object class="GtkImage" id="icon">
-        <property name="can_focus">False</property>
         <property name="pixel_size">96</property>
         <style>
           <class name="dim-label"/>
@@ -19,7 +17,6 @@
         <property name="spacing">6</property>
         <child>
           <object class="GtkLabel" id="title">
-            <property name="can_focus">False</property>
             <property name="justify">center</property>
             <property name="max_width_chars">65</property>
             <property name="wrap">True</property>
@@ -30,7 +27,6 @@
         </child>
         <child>
           <object class="GtkLabel" id="subtitle">
-            <property name="can_focus">False</property>
             <property name="justify">center</property>
             <property name="max_width_chars">65</property>
             <property name="wrap">True</property>
diff --git a/gnome-initial-setup/gis-page.c b/gnome-initial-setup/gis-page.c
index 25729d09..7c53565a 100644
--- a/gnome-initial-setup/gis-page.c
+++ b/gnome-initial-setup/gis-page.c
@@ -42,7 +42,7 @@ struct _GisPagePrivate
 };
 typedef struct _GisPagePrivate GisPagePrivate;
 
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GisPage, gis_page, GTK_TYPE_BIN);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GisPage, gis_page, ADW_TYPE_BIN);
 
 enum
 {
@@ -238,10 +238,6 @@ gis_page_class_init (GisPageClass *klass)
 static void
 gis_page_init (GisPage *page)
 {
-  gtk_widget_set_margin_start (GTK_WIDGET (page), 12);
-  gtk_widget_set_margin_top (GTK_WIDGET (page), 12);
-  gtk_widget_set_margin_bottom (GTK_WIDGET (page), 12);
-  gtk_widget_set_margin_end (GTK_WIDGET (page), 12);
 }
 
 char *
diff --git a/gnome-initial-setup/gis-page.h b/gnome-initial-setup/gis-page.h
index ecc38b62..9e46b459 100644
--- a/gnome-initial-setup/gis-page.h
+++ b/gnome-initial-setup/gis-page.h
@@ -24,6 +24,8 @@
 
 #include "gnome-initial-setup.h"
 
+#include <adwaita.h>
+
 G_BEGIN_DECLS
 
 #define GIS_TYPE_PAGE               (gis_page_get_type ())
@@ -44,14 +46,14 @@ typedef void (* GisPageApplyCallback) (GisPage *page,
 
 struct _GisPage
 {
-  GtkBin parent;
+  AdwBin parent;
 
   GisDriver *driver;
 };
 
 struct _GisPageClass
 {
-  GtkBinClass parent_class;
+  AdwBinClass parent_class;
   char *page_id;
 
   void         (*locale_changed) (GisPage *page);
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 97e0c9ca..b5d4fe31 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -23,11 +23,11 @@
 
 #include "gnome-initial-setup.h"
 
+#include <adwaita.h>
 #include <pwd.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <glib/gi18n.h>
-#include <handy.h>
 
 //#include "pages/welcome/gis-welcome-page.h"
 //#include "pages/language/gis-language-page.h"
@@ -173,10 +173,23 @@ destroy_pages_after (GisAssistant *assistant,
   l = l->next;
   for (; l != NULL; l = next) {
     next = l->next;
-    gtk_widget_destroy (GTK_WIDGET (l->data));
+    gis_assistant_remove_page (assistant, l->data);
   }
 }
 
+static void
+destroy_page (gpointer data)
+{
+  GtkWidget *assistant;
+  GisPage *page;
+
+  page = data;
+  assistant = gtk_widget_get_ancestor (GTK_WIDGET (page), GIS_TYPE_ASSISTANT);
+
+  if (assistant)
+    gis_assistant_remove_page (GIS_ASSISTANT (assistant), page);
+}
+
 static void
 rebuild_pages_cb (GisDriver *driver)
 {
@@ -192,7 +205,7 @@ rebuild_pages_cb (GisDriver *driver)
   page_data = page_table;
 
   g_ptr_array_free (skipped_pages, TRUE);
-  skipped_pages = g_ptr_array_new_with_free_func ((GDestroyNotify) gtk_widget_destroy);
+  skipped_pages = g_ptr_array_new_with_free_func (destroy_page);
 
   if (current_page != NULL) {
     destroy_pages_after (assistant, current_page);
@@ -272,13 +285,13 @@ main (int argc, char *argv[])
 
   g_unsetenv ("GIO_USE_VFS");
 
-  /* By default, libhandy reads settings from the Settings portal, which causes
+  /* By default, libadwaita reads settings from the Settings portal, which causes
    * the portal to be started, which causes gnome-keyring to be started. This
    * interferes with our attempt below to manually start gnome-keyring and set
    * the login keyring password to a well-known value, which we overwrite with
    * the user's password once they choose one.
    */
-  g_setenv ("HDY_DISABLE_PORTAL", "1", TRUE);
+  g_setenv ("ADW_DISABLE_PORTAL", "1", TRUE);
 
   context = g_option_context_new (_("— GNOME initial setup"));
   g_option_context_add_main_entries (context, entries, NULL);
@@ -289,18 +302,13 @@ main (int argc, char *argv[])
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
 
-  gtk_init (&argc, &argv);
-  hdy_init ();
-  hdy_style_manager_set_color_scheme (hdy_style_manager_get_default (),
-    HDY_COLOR_SCHEME_PREFER_LIGHT);
-
   g_message ("Starting gnome-initial-setup");
   if (gis_get_mock_mode ())
     g_message ("Mock mode: changes will not be saved to disk");
   else
     g_message ("Production mode: changes will be saved to disk");
 
-  skipped_pages = g_ptr_array_new_with_free_func ((GDestroyNotify) gtk_widget_destroy);
+  skipped_pages = g_ptr_array_new_with_free_func (destroy_page);
   mode = get_mode ();
 
   /* When we are running as the gnome-initial-setup user we
@@ -312,6 +320,8 @@ main (int argc, char *argv[])
     gis_ensure_login_keyring ();
 
   driver = gis_driver_new (mode);
+  adw_style_manager_set_color_scheme (adw_style_manager_get_default (),
+                                      ADW_COLOR_SCHEME_PREFER_LIGHT);
 
   /* On first login, GNOME Shell offers to run a tour. If we also run Initial
    * Setup, the two immovable, centred windows will sit atop one another.
diff --git a/gnome-initial-setup/meson.build b/gnome-initial-setup/meson.build
index bf9e37fc..1f5b1122 100644
--- a/gnome-initial-setup/meson.build
+++ b/gnome-initial-setup/meson.build
@@ -27,6 +27,13 @@ sources += [
     'gis-keyring.h'
 ]
 
+libadwaita_dep = dependency(
+  'libadwaita-1',
+  version: '>= 1.2.alpha',
+  fallback: ['libadwaita', 'libadwaita_dep'],
+  default_options: ['examples=false', 'introspection=disabled', 'tests=false', 'vapi=false'],
+)
+
 dependencies = [
     #dependency ('libnm', version: '>= 1.2'),
     #dependency ('libnma', version: '>= 1.0'),
@@ -38,13 +45,12 @@ dependencies = [
     dependency ('fontconfig'),
     #dependency ('goa-1.0'),
     #dependency ('goa-backend-1.0'),
-    dependency ('gtk+-3.0', version: '>= 3.11.3'),
+    dependency ('gtk4', version: '>= 4.6'),
     dependency ('glib-2.0', version: '>= 2.63.1'),
     dependency ('gio-unix-2.0', version: '>= 2.53.0'),
     dependency ('gdm', version: '>= 3.8.3'),
     #dependency ('gweather4'),
     #dependency ('libgeoclue-2.0', version: '>= 2.3.1'),
-    dependency ('libhandy-1', version: '>= 1.5.90'),
     cc.find_library('m', required: false),
     dependency ('pango', version: '>= 1.32.5'),
     #dependency ('json-glib-1.0'),
@@ -52,10 +58,11 @@ dependencies = [
     dependency ('libsecret-1', version: '>= 0.18.8'),
     #dependency ('pwquality'),
     #dependency ('rest-1.0'),
-    dependency ('webkit2gtk-4.1'),
+    dependency ('webkit2gtk-5.0'),
     #ibus_dep,
     #libmalcontent_dep,
     #libmalcontent_ui_dep,
+    libadwaita_dep,
 ]
 
 executable(
diff --git a/subprojects/libadwaita.wrap b/subprojects/libadwaita.wrap
new file mode 100644
index 00000000..7f0376cf
--- /dev/null
+++ b/subprojects/libadwaita.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://gitlab.gnome.org/GNOME/libadwaita.git
+revision = main
\ No newline at end of file


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