[gnome-software] details page: Hide 'Updated' field for plugins that don't set that



commit b226f5a918053e52f6c02acce78621894831dfc7
Author: Kalev Lember <klember redhat com>
Date:   Wed Jan 24 11:41:46 2018 +0100

    details page: Hide 'Updated' field for plugins that don't set that
    
    This keeps the status quo for the packagekit plugin that sets the value,
    but hides it for others that don't (e.g. rpm-ostree), avoiding an
    "Updated: Never" label on each and every app page.

 src/gs-details-page.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index f6c5f2a..b5f613c 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -107,6 +107,7 @@ struct _GsDetailsPage
        GtkWidget               *label_details_size_installed_value;
        GtkWidget               *label_details_size_download_title;
        GtkWidget               *label_details_size_download_value;
+       GtkWidget               *label_details_updated_title;
        GtkWidget               *label_details_updated_value;
        GtkWidget               *label_details_version_value;
        GtkWidget               *label_failed;
@@ -918,10 +919,14 @@ gs_details_page_refresh_all (GsDetailsPage *self)
 
        /* set the updated date */
        updated = gs_app_get_install_date (self->app);
-       if (updated == GS_APP_INSTALL_DATE_UNKNOWN ||
-           updated == GS_APP_INSTALL_DATE_UNSET) {
+       if (updated == GS_APP_INSTALL_DATE_UNSET) {
+               gtk_widget_set_visible (self->label_details_updated_title, FALSE);
+               gtk_widget_set_visible (self->label_details_updated_value, FALSE);
+       } else if (updated == GS_APP_INSTALL_DATE_UNKNOWN) {
                /* TRANSLATORS: this is where the updated date is not known */
                gtk_label_set_label (GTK_LABEL (self->label_details_updated_value), C_("updated", "Never"));
+               gtk_widget_set_visible (self->label_details_updated_title, TRUE);
+               gtk_widget_set_visible (self->label_details_updated_value, TRUE);
        } else {
                g_autoptr(GDateTime) dt = NULL;
                g_autofree gchar *updated_str = NULL;
@@ -940,6 +945,8 @@ gs_details_page_refresh_all (GsDetailsPage *self)
                        gtk_label_set_markup (GTK_LABEL (self->label_details_updated_value), url->str);
                        g_string_free (url, TRUE);
                }
+               gtk_widget_set_visible (self->label_details_updated_title, TRUE);
+               gtk_widget_set_visible (self->label_details_updated_value, TRUE);
        }
 
        /* set the category */
@@ -2369,6 +2376,7 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_size_download_value);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, 
label_details_size_installed_title);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, 
label_details_size_installed_value);
+       gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_updated_title);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_updated_value);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_version_value);
        gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_failed);


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