[gnome-software] Only show a details warning line for webapps



commit 2f5b22032792493844c3fa5c5ddc6e8b80029613
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jul 11 15:38:57 2016 +0100

    Only show a details warning line for webapps
    
    We're already showing the source and the license more clearly.

 src/gs-shell-details.c  |   45 +++----------------------
 src/gs-shell-details.ui |   85 +++++++++++++++-------------------------------
 src/gtk-style.css       |    9 -----
 3 files changed, 33 insertions(+), 106 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 544c875..e1a3ad7 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -107,7 +107,7 @@ struct _GsShellDetails
        GtkWidget               *label_details_version_value;
        GtkWidget               *label_failed;
        GtkWidget               *label_pending;
-       GtkWidget               *label_details_info_text;
+       GtkWidget               *label_details_webapp;
        GtkWidget               *label_license_nonfree_details;
        GtkWidget               *list_box_addons;
        GtkWidget               *box_reviews;
@@ -716,8 +716,6 @@ gs_shell_details_refresh_all (GsShellDetails *self)
        guint64 updated;
        guint64 user_integration_bf;
        g_autoptr(GError) error = NULL;
-       gboolean show_nonfree = FALSE;
-       gboolean is_3rd_party = FALSE;
 
        /* change widgets */
        tmp = gs_app_get_name (self->app);
@@ -915,44 +913,11 @@ gs_shell_details_refresh_all (GsShellDetails *self)
        gtk_widget_set_sensitive (self->image_details_kudo_integration, ret);
        gs_shell_details_set_sensitive (self->label_details_kudo_integration, ret);
 
-       /* set the tags buttons */
+       /* show the webapp warning */
        if (gs_app_get_kind (self->app) == AS_APP_KIND_WEB_APP) {
-               show_nonfree = FALSE;
-               gtk_widget_set_visible (self->label_details_info_text, TRUE);
-               gtk_label_set_label (GTK_LABEL (self->label_details_info_text),
-                                    /* TRANSLATORS: this is the warning box */
-                                    _("This application can only be used when there is an active internet 
connection."));
+               gtk_widget_set_visible (self->label_details_webapp, TRUE);
        } else {
-               /* Override the non-free label visibility from the settings
-                * if needed */
-               show_nonfree = !gs_app_get_license_is_free (self->app) &&
-                       g_settings_get_boolean (self->settings,
-                                               "show-nonfree-ui");
-               is_3rd_party = !gs_app_has_quirk (self->app,
-                                                 AS_APP_QUIRK_PROVENANCE);
-
-               if (!show_nonfree && is_3rd_party) {
-                       gtk_widget_set_visible (self->label_details_info_text, TRUE);
-                       gtk_label_set_label (GTK_LABEL (self->label_details_info_text),
-                                            /* TRANSLATORS: this is the warning box */
-                                            _("This software comes from a 3rd party."));
-               } else if (show_nonfree && is_3rd_party) {
-                       show_nonfree = TRUE;
-                       gtk_widget_set_visible (self->label_details_info_text, TRUE);
-                       gtk_label_set_label (GTK_LABEL (self->label_details_info_text),
-                                            /* TRANSLATORS: this is the warning box */
-                                            _("This software comes from a 3rd party and may contain non-free 
components."));
-               } else if (show_nonfree && !is_3rd_party) {
-                       show_nonfree = TRUE;
-                       gtk_widget_set_visible (self->label_details_info_text, TRUE);
-                       gtk_label_set_label (GTK_LABEL (self->label_details_info_text),
-                                            /* TRANSLATORS: this is the warning box */
-                                            _("This software may contain non-free components."));
-               } else {
-                       /* free and not 3rd party */
-                       show_nonfree = FALSE;
-                       gtk_widget_set_visible (self->label_details_info_text, FALSE);
-               }
+               gtk_widget_set_visible (self->label_details_webapp, FALSE);
        }
 
        /* hide the kudo details for non-desktop software */
@@ -1987,7 +1952,7 @@ gs_shell_details_class_init (GsShellDetailsClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_version_value);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_failed);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_pending);
-       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_info_text);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_webapp);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, list_box_addons);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, box_reviews);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, histogram);
diff --git a/src/gs-shell-details.ui b/src/gs-shell-details.ui
index 6f0ba1f..307ea01 100644
--- a/src/gs-shell-details.ui
+++ b/src/gs-shell-details.ui
@@ -447,6 +447,27 @@
                             <property name="position">3</property>
                           </packing>
                         </child>
+
+                        <child>
+                          <object class="GtkLabel" id="label_details_webapp">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">start</property>
+                            <property name="valign">start</property>
+                            <property name="margin_top">10</property>
+                            <property name="label" translatable="yes" comments="this is the warning 
box">This application can only be used when there is an active internet connection.</property>
+                            <property name="xalign">0</property>
+                            <attributes>
+                              <attribute name="weight" value="bold"/>
+                            </attributes>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">4</property>
+                          </packing>
+                        </child>
+
                         <child>
                           <object class="GsInfoBar" id="infobar_details_app_repo">
                             <property name="visible">True</property>
@@ -458,7 +479,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">4</property>
+                            <property name="position">5</property>
                           </packing>
                         </child>
                         <child>
@@ -472,7 +493,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">5</property>
+                            <property name="position">6</property>
                           </packing>
                         </child>
                         <child>
@@ -486,7 +507,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">6</property>
+                            <property name="position">7</property>
                           </packing>
                         </child>
                         <child>
@@ -501,7 +522,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">7</property>
+                            <property name="position">8</property>
                           </packing>
                         </child>
                         <child>
@@ -529,7 +550,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">8</property>
+                            <property name="position">9</property>
                           </packing>
                         </child>
                         <child>
@@ -550,7 +571,7 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">9</property>
+                            <property name="position">10</property>
                           </packing>
                         </child>
                         <child>
@@ -1040,59 +1061,9 @@
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">10</property>
+                            <property name="position">11</property>
                           </packing>
                         </child>
-
-                        <child>
-                          <object class="GtkBox" id="box_details_info">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="margin_top">28</property>
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">12</property>
-                            <child>
-                              <object class="GtkBox" id="box_details_info2">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="orientation">vertical</property>
-                                <child>
-                                  <object class="GtkLabel" id="label_details_info_text">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label">This software comes from a 3rd party and may 
contain non-free components.</property>
-                                    <style>
-                                      <class name="kudo-label"/>
-                                    </style>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel" id="label_details_info_url">
-                                    <property name="can_focus">False</property>
-                                    <property name="label">Find out more...</property>
-                                    <property name="use_underline">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                        </child>
-
                         <child>
                           <object class="GtkBox" id="box_addons">
                             <property name="visible">True</property>
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 75ce4ea..b5614b9 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -103,15 +103,6 @@
        opacity: 0.25;
 }
 
-.kudo-label {
-       background-image: none;
-       background-color: shade(@theme_selected_bg_color, 1.2);
-       border-color: shade(@theme_selected_bg_color, 1.0);
-       border-style: solid;
-       border-width: 1px;
-       padding: 15px;
-}
-
 .screenshot-image, .screenshot-image-thumb {
        background-image: none;
        background-color: shade(@theme_bg_color, 0.9);


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