[gnome-software] Explain the tags clearly on the details page



commit 92247f4208eb59c7b7587fdf8e88902cb8b55235
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jan 29 14:59:39 2016 +0000

    Explain the tags clearly on the details page

 src/gs-shell-details.c  |   88 +++++++++++++++++---------
 src/gs-shell-details.ui |  161 +++++++++++++++++++++++++++++++----------------
 src/gtk-style.css       |   17 ++++--
 3 files changed, 178 insertions(+), 88 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 1f4a116..64c04d9 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -72,7 +72,6 @@ struct _GsShellDetails
        GtkWidget               *infobar_details_app_repo;
        GtkWidget               *infobar_details_package_baseos;
        GtkWidget               *infobar_details_repo;
-       GtkWidget               *infobar_details_webapp;
        GtkWidget               *label_addons_uninstalled_app;
        GtkWidget               *label_details_category_value;
        GtkWidget               *label_details_developer_title;
@@ -85,6 +84,10 @@ struct _GsShellDetails
        GtkWidget               *label_details_version_value;
        GtkWidget               *label_failed;
        GtkWidget               *label_pending;
+       GtkWidget               *label_details_tag_nonfree;
+       GtkWidget               *label_details_tag_3rdparty;
+       GtkWidget               *label_details_tag_webapp;
+       GtkWidget               *label_details_info_text;
        GtkWidget               *list_box_addons;
        GtkWidget               *scrolledwindow_details;
        GtkWidget               *spinner_details;
@@ -577,7 +580,6 @@ gs_shell_details_refresh_all (GsShellDetails *self)
        GPtrArray *history;
        GdkPixbuf *pixbuf = NULL;
        GList *addons;
-       GtkStyleContext *sc;
        GtkWidget *widget;
        const gchar *tmp;
        gboolean ret;
@@ -739,27 +741,18 @@ gs_shell_details_refresh_all (GsShellDetails *self)
        /* set MyLanguage kudo */
        kudos = gs_app_get_kudos (self->app);
        ret = (kudos & GS_APP_KUDO_MY_LANGUAGE) > 0;
-       gs_shell_details_set_sensitive (self->image_details_kudo_translated, ret);
+       gtk_widget_set_sensitive (self->image_details_kudo_translated, ret);
        gs_shell_details_set_sensitive (self->label_details_kudo_translated, ret);
-       sc = gtk_widget_get_style_context (self->image_details_kudo_translated);
-       ret ? gtk_style_context_add_class (sc, "kudo-pill-active") :
-             gtk_style_context_remove_class (sc, "kudo-pill-active");
 
        /* set RecentRelease kudo */
        ret = (kudos & GS_APP_KUDO_RECENT_RELEASE) > 0;
-       gs_shell_details_set_sensitive (self->image_details_kudo_updated, ret);
+       gtk_widget_set_sensitive (self->image_details_kudo_updated, ret);
        gs_shell_details_set_sensitive (self->label_details_kudo_updated, ret);
-       sc = gtk_widget_get_style_context (self->image_details_kudo_updated);
-       ret ? gtk_style_context_add_class (sc, "kudo-pill-active") :
-             gtk_style_context_remove_class (sc, "kudo-pill-active");
 
        /* set UserDocs kudo */
        ret = (kudos & GS_APP_KUDO_INSTALLS_USER_DOCS) > 0;
-       gs_shell_details_set_sensitive (self->image_details_kudo_docs, ret);
+       gtk_widget_set_sensitive (self->image_details_kudo_docs, ret);
        gs_shell_details_set_sensitive (self->label_details_kudo_docs, ret);
-       sc = gtk_widget_get_style_context (self->image_details_kudo_docs);
-       ret ? gtk_style_context_add_class (sc, "kudo-pill-active") :
-             gtk_style_context_remove_class (sc, "kudo-pill-active");
 
        /* any of the various integration kudos */
        user_integration_bf = GS_APP_KUDO_SEARCH_PROVIDER |
@@ -767,11 +760,54 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                              GS_APP_KUDO_USES_APP_MENU |
                              GS_APP_KUDO_HIGH_CONTRAST;
        ret = (kudos & user_integration_bf) > 0;
-       gs_shell_details_set_sensitive (self->image_details_kudo_integration, ret);
+       gtk_widget_set_sensitive (self->image_details_kudo_integration, ret);
        gs_shell_details_set_sensitive (self->label_details_kudo_integration, ret);
-       sc = gtk_widget_get_style_context (self->image_details_kudo_integration);
-       ret ? gtk_style_context_add_class (sc, "kudo-pill-active") :
-             gtk_style_context_remove_class (sc, "kudo-pill-active");
+
+       /* set the tags buttons */
+       if (gs_app_get_id_kind (self->app) == AS_ID_KIND_WEB_APP) {
+               gtk_widget_set_visible (self->label_details_tag_webapp, TRUE);
+               gtk_widget_set_visible (self->label_details_tag_nonfree, FALSE);
+               gtk_widget_set_visible (self->label_details_tag_3rdparty, 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."));
+       } else {
+               gtk_widget_set_visible (self->label_details_tag_webapp, FALSE);
+               if (gs_app_get_licence_is_free (self->app) &&
+                   !gs_app_get_provenance (self->app)) {
+                       /* free and 3rd party */
+                       gtk_widget_set_visible (self->label_details_tag_nonfree, FALSE);
+                       gtk_widget_set_visible (self->label_details_tag_3rdparty, 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."));
+               } else if (!gs_app_get_licence_is_free (self->app) &&
+                          !gs_app_get_provenance (self->app)) {
+                       /* nonfree and 3rd party */
+                       gtk_widget_set_visible (self->label_details_tag_nonfree, TRUE);
+                       gtk_widget_set_visible (self->label_details_tag_3rdparty, 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 (!gs_app_get_licence_is_free (self->app) &&
+                          gs_app_get_provenance (self->app)) {
+                       /* nonfree and distro */
+                       gtk_widget_set_visible (self->label_details_tag_nonfree, TRUE);
+                       gtk_widget_set_visible (self->label_details_tag_3rdparty, 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 software may contain non-free components."));
+               } else {
+                       /* free and not 3rd party */
+                       gtk_widget_set_visible (self->label_details_tag_nonfree, FALSE);
+                       gtk_widget_set_visible (self->label_details_tag_3rdparty, FALSE);
+                       gtk_widget_set_visible (self->label_details_info_text, FALSE);
+               }
+       }
 
        /* don't show a missing rating on a local file */
        if (gs_app_get_state (self->app) == AS_APP_STATE_AVAILABLE_LOCAL &&
@@ -847,16 +883,6 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                break;
        }
 
-       /* installing a webapp */
-       switch (gs_app_get_id_kind (self->app)) {
-       case AS_ID_KIND_WEB_APP:
-               gtk_widget_set_visible (self->infobar_details_webapp, TRUE);
-               break;
-       default:
-               gtk_widget_set_visible (self->infobar_details_webapp, FALSE);
-               break;
-       }
-
        /* only show the "select addons" string if the app isn't yet installed */
        switch (gs_app_get_state (self->app)) {
        case AS_APP_STATE_INSTALLED:
@@ -1073,6 +1099,7 @@ gs_shell_details_load (GsShellDetails *self)
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_PROVENANCE |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_ADDONS,
                                           self->cancellable,
                                           gs_shell_details_app_refine_cb,
@@ -1408,7 +1435,6 @@ gs_shell_details_class_init (GsShellDetailsClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, infobar_details_app_repo);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, infobar_details_package_baseos);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, infobar_details_repo);
-       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, infobar_details_webapp);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_addons_uninstalled_app);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_category_value);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_developer_title);
@@ -1421,6 +1447,10 @@ 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_tag_nonfree);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_tag_3rdparty);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_tag_webapp);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_info_text);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, list_box_addons);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, scrolledwindow_details);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, spinner_details);
diff --git a/src/gs-shell-details.ui b/src/gs-shell-details.ui
index 73a63ee..1332b35 100644
--- a/src/gs-shell-details.ui
+++ b/src/gs-shell-details.ui
@@ -509,59 +509,6 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkInfoBar" id="infobar_details_webapp">
-                        <property name="visible">True</property>
-                        <property name="app_paintable">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="message_type">info</property>
-                        <property name="margin_top">20</property>
-                        <style>
-                          <class name="application-details-infobar"/>
-                        </style>
-                        <child internal-child="content_area">
-                          <object class="GtkBox" id="infobar-content_area5">
-                            <property name="can_focus">False</property>
-                            <property name="spacing">0</property>
-                            <property name="halign">fill</property>
-                            <property name="orientation">vertical</property>
-                            <child>
-                              <object class="GtkLabel" id="label_header_details_webapp">
-                                <property name="justify">center</property>
-                                <property name="wrap">True</property>
-                                <property name="max_width_chars">30</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label" translatable="yes">Internet Only 
Application</property>
-                                <attributes>
-                                  <attribute name="weight" value="bold"/>
-                                </attributes>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label_details_webapp">
-                                <property name="justify">center</property>
-                                <property name="wrap">True</property>
-                                <property name="max_width_chars">30</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="label" translatable="yes">This application can only be used 
when there is an active internet connection.</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">7</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkBox" id="box_details_support">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -1009,6 +956,112 @@
                     </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_info_tags">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label_details_tag_nonfree">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">non-free</property>
+                                <style>
+                                  <class name="app-row-tag"/>
+                                </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_tag_3rdparty">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">3rd party</property>
+                                 <style>
+                                  <class name="app-row-tag"/>
+                                </style>
+                             </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label_details_tag_webapp">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">web app</property>
+                                <style>
+                                  <class name="app-row-tag"/>
+                                </style>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <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>
                         <property name="orientation">vertical</property>
@@ -1068,7 +1121,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">11</property>
+                        <property name="position">12</property>
                       </packing>
                     </child>
 
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 100799d..505f0a8 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -27,16 +27,23 @@
 
 .kudo-pill {
        color: @theme_selected_fg_color;
-       background-color: shade(@theme_bg_color, 0.4);
-       width: 32px;
-       height: 32px;
+       background-color: shade(@theme_selected_bg_color, 1.1);
+       background-image: none;
        border-radius: 16px;
        padding: 8px;
 }
 
-.kudo-pill-active {
+.kudo-pill:disabled {
+       background-color: shade(@theme_bg_color, 0.8);
+}
+
+.kudo-label {
        background-image: none;
-       background-color: shade(@theme_selected_bg_color, 1.1);
+       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 {


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