[gnome-software/wip/rancell/snap-auth-3-20-rebase: 11/34] Hide licence, updated and category fields if they aren't set



commit 0d8dc1426eee95089210d38bbc20a7542e074430
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Mar 29 11:30:08 2016 +1300

    Hide licence, updated and category fields if they aren't set

 src/gs-shell-details.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index b3a793c..6a3f24e 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -78,13 +78,16 @@ struct _GsShellDetails
        GtkWidget               *infobar_details_package_baseos;
        GtkWidget               *infobar_details_repo;
        GtkWidget               *label_addons_uninstalled_app;
+       GtkWidget               *label_details_category_title;
        GtkWidget               *label_details_category_value;
        GtkWidget               *label_details_developer_title;
        GtkWidget               *label_details_developer_value;
+       GtkWidget               *label_details_license_title;
        GtkWidget               *label_details_license_value;
        GtkWidget               *label_details_origin_title;
        GtkWidget               *label_details_origin_value;
        GtkWidget               *label_details_size_value;
+       GtkWidget               *label_details_updated_title;
        GtkWidget               *label_details_updated_value;
        GtkWidget               *label_details_version_value;
        GtkWidget               *label_failed;
@@ -668,9 +671,13 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                /* TRANSLATORS: this is where the license is not known */
                gtk_label_set_label (GTK_LABEL (self->label_details_license_value), C_("license", "Unknown"));
                gtk_widget_set_tooltip_text (self->label_details_license_value, NULL);
+               gtk_widget_set_visible (self->label_details_license_title, FALSE);
+               gtk_widget_set_visible (self->label_details_license_value, FALSE);
        } else {
                gtk_label_set_markup (GTK_LABEL (self->label_details_license_value), tmp);
                gtk_widget_set_tooltip_text (self->label_details_license_value, NULL);
+               gtk_widget_set_visible (self->label_details_license_title, TRUE);
+               gtk_widget_set_visible (self->label_details_license_value, TRUE);
        }
 
        /* set version */
@@ -700,13 +707,18 @@ gs_shell_details_refresh_all (GsShellDetails *self)
        if (updated == GS_APP_INSTALL_DATE_UNKNOWN ||
            updated == GS_APP_INSTALL_DATE_UNSET) {
                /* 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_label_set_label (GTK_LABEL (self->label_details_updated_value), C_("updated", "Never"));
+               gtk_widget_set_visible (self->label_details_updated_title, FALSE);
+               gtk_widget_set_visible (self->label_details_updated_value, FALSE);
        } else {
                g_autoptr(GDateTime) dt = NULL;
                g_autofree gchar *updated_str = NULL;
                dt = g_date_time_new_from_unix_utc (updated);
                updated_str = g_date_time_format (dt, "%x");
                gtk_label_set_label (GTK_LABEL (self->label_details_updated_value), updated_str);
+               gtk_widget_set_visible (self->label_details_updated_title, TRUE);
+               gtk_widget_set_visible (self->label_details_updated_value, TRUE);
        }
 
        /* set the category */
@@ -715,6 +727,8 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                /* TRANSLATORS: this is the application isn't in any
                 * defined menu category */
                gtk_label_set_label (GTK_LABEL (self->label_details_category_value), C_("menu category", 
"None"));
+               gtk_widget_set_visible (self->label_details_category_title, FALSE);
+               gtk_widget_set_visible (self->label_details_category_value, FALSE);
        } else {
                g_autofree gchar *path = NULL;
                if (gtk_widget_get_direction (self->label_details_category_value) == GTK_TEXT_DIR_RTL)
@@ -722,6 +736,8 @@ gs_shell_details_refresh_all (GsShellDetails *self)
                else
                        path = g_strjoinv (" → ", menu_path);
                gtk_label_set_label (GTK_LABEL (self->label_details_category_value), path);
+               gtk_widget_set_visible (self->label_details_category_title, TRUE);
+               gtk_widget_set_visible (self->label_details_category_value, TRUE);
        }
 
        /* set the origin */
@@ -1695,13 +1711,16 @@ gs_shell_details_class_init (GsShellDetailsClass *klass)
        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, label_addons_uninstalled_app);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_category_title);
        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);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_developer_value);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_license_title);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_license_value);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_origin_title);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_origin_value);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_size_value);
+       gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_updated_title);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_updated_value);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_details_version_value);
        gtk_widget_class_bind_template_child (widget_class, GsShellDetails, label_failed);


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