[gnome-software: 2/3] gs-license-tile: Add a ‘Learn More’ link to the proprietary tile




commit 7d45ba8982bbe1a30cbeb45bc44c1880dd044126
Author: Philip Withnall <pwithnall endlessos org>
Date:   Sun Jul 24 21:13:54 2022 +0200

    gs-license-tile: Add a ‘Learn More’ link to the proprietary tile
    
    This links to a wiki page where we can explain the differences between
    FOSS and proprietary software in more detail. This means that we can
    explain more of the nuances and risks without being limited by the word
    limit in the license tile widget.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1421

 src/gs-details-page.c  | 18 +++++++++++++++---
 src/gs-license-tile.c  | 12 ++++++++----
 src/gs-license-tile.ui |  5 +++--
 3 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 03bdc0b6e..af5de904f 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -497,11 +497,23 @@ gs_details_page_license_tile_get_involved_activated_cb (GsLicenseTile *license_t
 {
        const gchar *uri = NULL;
 
+       if (gs_app_get_license_is_free (self->app)) {
 #if AS_CHECK_VERSION(0, 15, 3)
-       uri = gs_app_get_url (self->app, AS_URL_KIND_CONTRIBUTE);
+               uri = gs_app_get_url (self->app, AS_URL_KIND_CONTRIBUTE);
 #endif
-       if (uri == NULL)
-               uri = gs_app_get_url (self->app, AS_URL_KIND_HOMEPAGE);
+               if (uri == NULL)
+                       uri = gs_app_get_url (self->app, AS_URL_KIND_HOMEPAGE);
+       } else {
+               /* Page to explain the differences between FOSS and proprietary
+                * software. This is a page on the gnome-software wiki for now,
+                * so that we can update the content independently of the release
+                * cycle. Likely, we will link to a more authoritative source
+                * to explain the differences.
+                * Ultimately, we could ship a user manual page to explain the
+                * differences (so that it’s available offline), but that’s too
+                * much work for right now. */
+               uri = "https://gitlab.gnome.org/GNOME/gnome-software/-/wikis/Software-licensing";;
+       }
 
        gs_shell_show_uri (self->shell, uri);
 }
diff --git a/src/gs-license-tile.c b/src/gs-license-tile.c
index 54ac6511a..0efd3fa62 100644
--- a/src/gs-license-tile.c
+++ b/src/gs-license-tile.c
@@ -43,7 +43,7 @@ struct _GsLicenseTile
        GtkWidget       *lozenges[3];
        GtkLabel        *title_label;
        GtkLabel        *description_label;
-       GtkListBoxRow   *get_involved_row;
+       GtkLabel        *get_involved_label;
 };
 
 G_DEFINE_TYPE (GsLicenseTile, gs_license_tile, GTK_TYPE_WIDGET)
@@ -84,6 +84,7 @@ gs_license_tile_refresh (GsLicenseTile *self)
        const gchar *lozenge_icon_names[3];
        g_autofree gchar *description = NULL;
        gboolean get_involved_visible;
+       const gchar *get_involved_label;
 
        /* Widget behaviour is undefined if the app is unspecified. */
        if (self->app == NULL)
@@ -101,6 +102,7 @@ gs_license_tile_refresh (GsLicenseTile *self)
 #else
                get_involved_visible = (gs_app_get_url (self->app, AS_URL_KIND_HOMEPAGE) != NULL);
 #endif
+               get_involved_label = _("_Get Involved");
 
                /* Translators: The placeholder here is the name of a software license. */
                description = g_strdup_printf (_("This software is developed in the open by a community of 
volunteers, and released under the %s license."
@@ -113,7 +115,8 @@ gs_license_tile_refresh (GsLicenseTile *self)
                lozenge_icon_names[0] = "dialog-warning-symbolic";
                lozenge_icon_names[1] = "face-sad-symbolic";
                lozenge_icon_names[2] = "padlock-open-symbolic";
-               get_involved_visible = FALSE;
+               get_involved_visible = TRUE;
+               get_involved_label = _("_Learn More");
 
                description = g_strdup (_("This software is not developed in the open, so only its developers 
know how it works. It may be insecure in ways that are hard to detect, and it may change without oversight."
                                          "\n\n"
@@ -130,7 +133,8 @@ gs_license_tile_refresh (GsLicenseTile *self)
 
        gtk_label_set_label (self->title_label, title);
        gtk_label_set_label (self->description_label, description);
-       gtk_widget_set_visible (GTK_WIDGET (self->get_involved_row), get_involved_visible);
+       gtk_widget_set_visible (GTK_WIDGET (self->get_involved_label), get_involved_visible);
+       gtk_label_set_label (self->get_involved_label, get_involved_label);
 }
 
 static void
@@ -238,7 +242,7 @@ gs_license_tile_class_init (GsLicenseTileClass *klass)
        gtk_widget_class_bind_template_child_full (widget_class, "lozenge2", FALSE, G_STRUCT_OFFSET 
(GsLicenseTile, lozenges[2]));
        gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, title_label);
        gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, description_label);
-       gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, get_involved_row);
+       gtk_widget_class_bind_template_child (widget_class, GsLicenseTile, get_involved_label);
 
        gtk_widget_class_bind_template_callback (widget_class, gs_license_tile_row_activated_cb);
 
diff --git a/src/gs-license-tile.ui b/src/gs-license-tile.ui
index 3ef3075d4..0a94a2871 100644
--- a/src/gs-license-tile.ui
+++ b/src/gs-license-tile.ui
@@ -81,8 +81,9 @@
         </child>
 
         <child>
-          <object class="GtkListBoxRow" id="get_involved_row">
+          <object class="GtkListBoxRow">
             <property name="activatable">True</property>
+            <property name="visible" bind-source="get_involved_label" bind-property="visible" 
bind-flags="sync-create"/>
             <child>
               <object class="GtkBox">
                 <property name="orientation">horizontal</property>
@@ -90,7 +91,7 @@
                 <property name="margin-top">12</property>
                 <property name="margin-bottom">12</property>
                 <child>
-                  <object class="GtkLabel">
+                  <object class="GtkLabel" id="get_involved_label">
                     <property name="xalign">0</property>
                     <property name="yalign">0.5</property>
                     <property name="label" translatable="yes">_Get Involved</property>


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