[gnome-initial-setup/wip/port-to-gtk4: 9/23] summary: Port to GTK4




commit 16325de27def9a9efd72fea6bedb9a630f667709
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 5 18:19:21 2022 -0300

    summary: Port to GTK4
    
    This is just a glorified AdwStatusPage now, but it looks mostly the
    same still.

 gnome-initial-setup/gnome-initial-setup.c          |  4 +-
 gnome-initial-setup/pages/meson.build              |  2 +-
 .../pages/summary/gis-summary-page.c               | 10 ++--
 .../pages/summary/gis-summary-page.ui              | 66 ++--------------------
 4 files changed, 13 insertions(+), 69 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 5614c692..748d2256 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -40,7 +40,7 @@
 //#include "pages/account/gis-account-pages.h"
 //#include "pages/parental-controls/gis-parental-controls-page.h"
 //#include "pages/password/gis-password-page.h"
-//#include "pages/summary/gis-summary-page.h"
+#include "pages/summary/gis-summary-page.h"
 
 #define VENDOR_PAGES_GROUP "pages"
 #define VENDOR_SKIP_KEY "skip"
@@ -76,7 +76,7 @@ static PageData page_table[] = {
   //PAGE (parental_controls, TRUE),
   //PAGE (parent_password, TRUE),
 #endif
-  //PAGE (summary,  FALSE),
+  PAGE (summary,  FALSE),
   { NULL },
 };
 
diff --git a/gnome-initial-setup/pages/meson.build b/gnome-initial-setup/pages/meson.build
index e6150074..beed10f1 100644
--- a/gnome-initial-setup/pages/meson.build
+++ b/gnome-initial-setup/pages/meson.build
@@ -8,7 +8,7 @@ pages = [
    #'goa',
    #'password',
    #'software',
-   #'summary',
+   'summary',
    'welcome',
 ]
 
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c 
b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 09c00abe..b9474550 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -39,8 +39,7 @@
 
 struct _GisSummaryPagePrivate {
   GtkWidget *start_button;
-  GtkWidget *start_button_label;
-  GtkWidget *tagline;
+  AdwStatusPage *status_page;
 
   ActUser *user_account;
   const gchar *user_password;
@@ -231,14 +230,14 @@ update_distro_name (GisSummaryPage *page)
    * like "Fedora" or "Ubuntu". It falls back to "GNOME" if we can't
    * detect any distribution. */
   text = g_strdup_printf (_("_Start Using %s"), name);
-  gtk_label_set_label (GTK_LABEL (priv->start_button_label), text);
+  gtk_button_set_label (GTK_BUTTON (priv->start_button), text);
   g_free (text);
 
   /* Translators: the parameter here is the name of a distribution,
    * like "Fedora" or "Ubuntu". It falls back to "GNOME" if we can't
    * detect any distribution. */
   text = g_strdup_printf (_("%s is ready to be used. We hope that you love it!"), name);
-  gtk_label_set_label (GTK_LABEL (priv->tagline), text);
+  adw_status_page_set_description (priv->status_page, text);
   g_free (text);
 }
 
@@ -274,8 +273,7 @@ gis_summary_page_class_init (GisSummaryPageClass *klass)
   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 
"/org/gnome/initial-setup/gis-summary-page.ui");
 
   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisSummaryPage, start_button);
-  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisSummaryPage, 
start_button_label);
-  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisSummaryPage, tagline);
+  gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GisSummaryPage, status_page);
 
   page_class->page_id = PAGE_ID;
   page_class->locale_changed = gis_summary_page_locale_changed;
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.ui 
b/gnome-initial-setup/pages/summary/gis-summary-page.ui
index cf2c2dee..b6dd3005 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.ui
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.ui
@@ -1,76 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
   <template class="GisSummaryPage" parent="GisPage">
     <child>
-      <object class="GtkBox" id="box">
-        <property name="visible">True</property>
-        <property name="halign">center</property>
-        <property name="valign">center</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">16</property>
-        <child type="center">
-          <object class="GtkImage" id="image">
-            <property name="visible">True</property>
-            <property name="resource">/org/gnome/initial-setup/ready-to-go.svg</property>
-            <property name="width_request">128</property>
-            <property name="height_request">128</property>
-          </object>
-          <packing>
-            <property name="pack_type">start</property>
-          </packing>
-        </child>
+      <object class="AdwStatusPage" id="status_page">
+        <property name="paintable">resource:///org/gnome/initial-setup/ready-to-go.svg</property>
+        <property name="title" translatable="yes">All done!</property>
+
         <child>
           <object class="GtkButton" id="start_button">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">False</property>
             <property name="use_underline">True</property>
             <property name="halign">center</property>
             <style>
               <class name="suggested-action"/>
-            </style>
-            <child>
-              <object class="GtkLabel" id="start_button_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="justify">center</property>
-                <property name="wrap">True</property>
-                <property name="xpad">8</property>
-                <property name="ypad">8</property>
-                <property name="use_underline">True</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="pack_type">end</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="tagline">
-            <property name="visible">True</property>
-            <property name="justify">center</property>
-            <property name="wrap">True</property>
-            <property name="max-width-chars">60</property>
-          </object>
-          <packing>
-            <property name="pack_type">end</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkLabel" id="title">
-            <property name="visible">True</property>
-            <property name="justify">center</property>
-            <property name="label" translatable="yes">All done!</property>
-            <property name="wrap">True</property>
-            <style>
-              <class name="large-title"/>
+              <class name="pill"/>
             </style>
           </object>
-          <packing>
-            <property name="pack_type">end</property>
-          </packing>
         </child>
+
       </object>
     </child>
   </template>


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