[gnome-initial-setup/wip/port-to-gtk4: 96/110] welcome: Port to GTK4




commit da42a746883add4b81091185649725f538546cda
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 5 13:19:39 2022 -0300

    welcome: Port to GTK4
    
    Pretty trivial of a port. Replace the header by a GtkPicture and
    load the resource in the UI file. Remove useless visible=True
    properties from the UI file.

 gnome-initial-setup/gnome-initial-setup.c             |  4 ++--
 gnome-initial-setup/pages/meson.build                 |  2 +-
 gnome-initial-setup/pages/welcome/gis-welcome-page.c  | 13 -------------
 gnome-initial-setup/pages/welcome/gis-welcome-page.ui | 14 +++++---------
 4 files changed, 8 insertions(+), 25 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index b5d4fe31..4fccd2ad 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <glib/gi18n.h>
 
-//#include "pages/welcome/gis-welcome-page.h"
+#include "pages/welcome/gis-welcome-page.h"
 //#include "pages/language/gis-language-page.h"
 //#include "pages/keyboard/gis-keyboard-page.h"
 //#include "pages/network/gis-network-page.h"
@@ -62,7 +62,7 @@ typedef struct {
 #define PAGE(name, new_user_only) { #name, gis_prepare_ ## name ## _page, new_user_only }
 
 static PageData page_table[] = {
-  //PAGE (welcome, FALSE),
+  PAGE (welcome, FALSE),
   //PAGE (language, FALSE),
   //PAGE (keyboard, FALSE),
   //PAGE (network,  FALSE),
diff --git a/gnome-initial-setup/pages/meson.build b/gnome-initial-setup/pages/meson.build
index 54b0050d..194117f4 100644
--- a/gnome-initial-setup/pages/meson.build
+++ b/gnome-initial-setup/pages/meson.build
@@ -9,7 +9,7 @@ pages = [
    #'password',
    #'software',
    #'summary',
-   #'welcome',
+   'welcome',
 ]
 
 #if libmalcontent_dep.found() and libmalcontent_ui_dep.found()
diff --git a/gnome-initial-setup/pages/welcome/gis-welcome-page.c 
b/gnome-initial-setup/pages/welcome/gis-welcome-page.c
index fc931eeb..41b11702 100644
--- a/gnome-initial-setup/pages/welcome/gis-welcome-page.c
+++ b/gnome-initial-setup/pages/welcome/gis-welcome-page.c
@@ -42,17 +42,6 @@ typedef struct
 
 G_DEFINE_TYPE_WITH_PRIVATE (GisWelcomePage, gis_welcome_page, GIS_TYPE_PAGE)
 
-static void
-update_welcome_header (GisWelcomePage *page)
-{
-  GisWelcomePagePrivate *priv = gis_welcome_page_get_instance_private (page);
-  const char *path = "/org/gnome/initial-setup/initial-setup-welcome.svg";
-  g_autoptr(GdkPixbuf) pixbuf = NULL;
-
-  pixbuf = gdk_pixbuf_new_from_resource_at_scale (path, 1000, -1, TRUE, NULL);
-  gtk_image_set_from_pixbuf (GTK_IMAGE (priv->header), pixbuf);
-}
-
 static void
 update_welcome_title (GisWelcomePage *page)
 {
@@ -95,11 +84,9 @@ gis_welcome_page_constructed (GObject *object)
 
   G_OBJECT_CLASS (gis_welcome_page_parent_class)->constructed (object);
 
-  update_welcome_header (page);
   update_welcome_title (page);
 
   gis_page_set_complete (GIS_PAGE (page), TRUE);
-  gtk_widget_show (GTK_WIDGET (page));
 }
 
 static void
diff --git a/gnome-initial-setup/pages/welcome/gis-welcome-page.ui 
b/gnome-initial-setup/pages/welcome/gis-welcome-page.ui
index 69936403..555dbb41 100644
--- a/gnome-initial-setup/pages/welcome/gis-welcome-page.ui
+++ b/gnome-initial-setup/pages/welcome/gis-welcome-page.ui
@@ -1,6 +1,5 @@
 <?xml version="1.0"?>
 <interface>
-  <requires lib="gtk+" version="3.0"/>
   <template class="GisWelcomePage" parent="GisPage">
     <property name="title" translatable="yes">Setup</property>
     <property name="margin-top">0</property>
@@ -10,26 +9,24 @@
     <property name="has-forward">1</property>
     <child>
       <object class="GtkBox" id="box">
-        <property name="visible">True</property>
         <property name="orientation">vertical</property>
         <property name="halign">fill</property>
         <property name="valign">fill</property>
         <child>
-          <object class="GtkImage" id="header">
-            <property name="visible">True</property>
+          <object class="GtkPicture" id="header">
+            <property name="valign">start</property>
+            <property name="vexpand">True</property>
+            <property name="file">resource:///org/gnome/initial-setup/initial-setup-welcome.svg</property>
           </object>
         </child>
         <child>
           <object class="GtkBox">
             <property name="orientation">vertical</property>
-            <property name="visible">True</property>
             <property name="vexpand">1</property>
             <property name="halign">center</property>
-            <property name="valign">center</property>
             <property name="spacing">20</property>
             <child>
               <object class="GtkLabel" id="title">
-                 <property name="visible">True</property>
                  <!-- This is set to a translated string at runtime -->
                  <property name="label">Welcome to the latest GNOME!</property>
                  <style>
@@ -39,7 +36,6 @@
             </child>
             <child>
               <object class="GtkLabel">
-                 <property name="visible">True</property>
                  <property name="label" translatable="yes">Setup will guide you through making an account 
and enabling some features. We’ll have you up and running in no time.</property>
                  <property name="wrap">1</property>
                  <property name="width-chars">35</property>
@@ -49,13 +45,13 @@
             </child>
             <child>
               <object class="GtkButton">
-                 <property name="visible">True</property>
                  <property name="halign">center</property>
                  <property name="label" translatable="yes">_Start Setup</property>
                  <property name="use-underline">1</property>
                  <signal name="clicked" handler="start_setup"/>
                  <style>
                    <class name="suggested-action"/>
+                   <class name="pill"/>
                  </style>
               </object>
             </child>


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