[gnome-initial-setup/wip/port-to-gtk4: 12/23] software: Port to GTK4




commit 97a947efc44967ebd58efc5eede6078037cdd820
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jul 7 09:12:44 2022 -0300

    software: Port to GTK4
    
    A boring page to port.

 gnome-initial-setup/gnome-initial-setup.c          |  4 +-
 gnome-initial-setup/pages/meson.build              |  2 +-
 .../pages/software/gis-software-page.c             | 11 +-----
 .../pages/software/gis-software-page.ui            | 46 +++++++++++++---------
 4 files changed, 32 insertions(+), 31 deletions(-)
---
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
index 5321c8a6..2f5d3cf6 100644
--- a/gnome-initial-setup/gnome-initial-setup.c
+++ b/gnome-initial-setup/gnome-initial-setup.c
@@ -35,7 +35,7 @@
 #include "pages/network/gis-network-page.h"
 #include "pages/timezone/gis-timezone-page.h"
 #include "pages/privacy/gis-privacy-page.h"
-//#include "pages/software/gis-software-page.h"
+#include "pages/software/gis-software-page.h"
 //#include "pages/goa/gis-goa-page.h"
 //#include "pages/account/gis-account-pages.h"
 //#include "pages/parental-controls/gis-parental-controls-page.h"
@@ -68,7 +68,7 @@ static PageData page_table[] = {
   PAGE (network,  FALSE),
   PAGE (privacy,  FALSE),
   PAGE (timezone, TRUE),
-  //PAGE (software, TRUE),
+  PAGE (software, TRUE),
   //PAGE (goa,      FALSE),
   //PAGE (account,  TRUE),
   //PAGE (password, TRUE),
diff --git a/gnome-initial-setup/pages/meson.build b/gnome-initial-setup/pages/meson.build
index aff33f2c..13313293 100644
--- a/gnome-initial-setup/pages/meson.build
+++ b/gnome-initial-setup/pages/meson.build
@@ -7,7 +7,7 @@ pages = [
    'privacy',
    #'goa',
    #'password',
-   #'software',
+   'software',
    'summary',
    'welcome',
 ]
diff --git a/gnome-initial-setup/pages/software/gis-software-page.c 
b/gnome-initial-setup/pages/software/gis-software-page.c
index a8045f9c..b68d143c 100644
--- a/gnome-initial-setup/pages/software/gis-software-page.c
+++ b/gnome-initial-setup/pages/software/gis-software-page.c
@@ -54,8 +54,6 @@ gis_software_page_constructed (GObject *object)
   G_OBJECT_CLASS (gis_software_page_parent_class)->constructed (object);
 
   gis_page_set_complete (GIS_PAGE (page), TRUE);
-
-  gtk_widget_show (GTK_WIDGET (page));
 }
 
 /* Distro-specific stuff is isolated here so that the rest of this page can be
@@ -81,8 +79,6 @@ gis_software_page_apply (GisPage      *gis_page,
   GisSoftwarePage *page = GIS_SOFTWARE_PAGE (gis_page);
   GisSoftwarePagePrivate *priv = gis_software_page_get_instance_private (page);
   g_autofree char *program = NULL;
-  g_autoptr (GSubprocessLauncher) launcher = NULL;
-  g_autoptr (GSubprocess) subprocess = NULL;
   g_autoptr (GError) error = NULL;
 
   program = find_fedora_third_party ();
@@ -118,19 +114,16 @@ static void
 enabled_state_changed (GisSoftwarePage *page)
 {
   GisSoftwarePagePrivate *priv = gis_software_page_get_instance_private (page);
-  GtkStyleContext *style;
-
-  style = gtk_widget_get_style_context (priv->enable_disable_button);
 
   if (priv->enabled)
     {
       gtk_button_set_label (GTK_BUTTON (priv->enable_disable_button), _("_Disable Third-Party 
Repositories"));
-      gtk_style_context_remove_class (style, "suggested-action");
+      gtk_widget_remove_css_class (priv->enable_disable_button, "suggested-action");
     }
   else
     {
       gtk_button_set_label (GTK_BUTTON (priv->enable_disable_button), _("_Enable Third-Party Repositories"));
-      gtk_style_context_add_class (style, "suggested-action");
+      gtk_widget_add_css_class (priv->enable_disable_button, "suggested-action");
     }
 }
 
diff --git a/gnome-initial-setup/pages/software/gis-software-page.ui 
b/gnome-initial-setup/pages/software/gis-software-page.ui
index 23ab9342..838c24df 100644
--- a/gnome-initial-setup/pages/software/gis-software-page.ui
+++ b/gnome-initial-setup/pages/software/gis-software-page.ui
@@ -1,30 +1,38 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
   <template class="GisSoftwarePage" parent="GisPage">
     <child>
-      <object class="GtkBox" id="box">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="halign">center</property>
-        <property name="valign">fill</property>
+      <object class="AdwPreferencesPage">
         <child>
-          <object class="GisPageHeader" id="header">
-            <property name="visible">True</property>
-            <property name="margin_top">24</property>
-            <property name="title" translatable="yes">Third-Party Repositories</property>
-            <property name="icon_name">gis-software-symbolic</property>
-            <property name="show_icon" bind-source="GisSoftwarePage" bind-property="small-screen" 
bind-flags="invert-boolean|sync-create"/>
+          <object class="AdwPreferencesGroup">
+            <child>
+              <object class="GisPageHeader" id="header">
+                <property name="margin_top">24</property>
+                <property name="title" translatable="yes">Third-Party Repositories</property>
+                <property name="icon_name">gis-software-symbolic</property>
+                <property name="show_icon" bind-source="GisSoftwarePage" bind-property="small-screen" 
bind-flags="invert-boolean|sync-create"/>
+              </object>
+            </child>
           </object>
         </child>
         <child>
-          <object class="GtkButton" id="enable_disable_button">
-            <property name="halign">center</property>
-            <property name="margin">36</property>
-            <property name="use-underline">True</property>
-            <property name="visible">True</property>
-            <signal name="clicked" handler="enable_disable_button_clicked_cb"/>
+          <object class="AdwPreferencesGroup">
+            <child>
+              <object class="GtkButton" id="enable_disable_button">
+                <property name="halign">center</property>
+                <property name="margin-top">36</property>
+                <property name="margin-bottom">36</property>
+                <property name="margin-start">36</property>
+                <property name="margin-end">36</property>
+                <property name="use-underline">True</property>
+                <property name="visible">True</property>
+                <signal name="clicked" handler="enable_disable_button_clicked_cb"/>
+                <style>
+                  <class name="suggested-action" />
+                  <class name="pill" />
+                </style>
+              </object>
+            </child>
           </object>
         </child>
       </object>


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