[gnome-software] updates: Hide the last checked label if we haven't yet checked for updates



commit abd3235cf807356e347a69e4e9a6129571fa7355
Author: Kalev Lember <kalevlember gmail com>
Date:   Wed Mar 26 17:52:33 2014 +0100

    updates: Hide the last checked label if we haven't yet checked for updates
    
    This prevents it from showing "Last checked: 1 January 1970".

 src/gs-shell-updates.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 6a9a19d..fdd4817 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -121,6 +121,8 @@ gs_shell_updates_last_checked_time_string (GsShellUpdates *shell_updates)
        gint days_ago;
 
        g_settings_get (priv->settings, "check-timestamp", "x", &tmp);
+       if (tmp == 0)
+               return NULL;
        last_checked = g_date_time_new_from_unix_local (tmp);
 
        midnight = time_next_midnight ();
@@ -351,16 +353,18 @@ gs_shell_updates_update_ui_state (GsShellUpdates *shell_updates)
 
        /* last checked label */
        if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (widget)), "uptodate") == 0) {
-               gchar *last_checked;
-
+               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_updates_last_checked"));
                tmp = gs_shell_updates_last_checked_time_string (shell_updates);
-               /* TRANSLATORS: This is the time when we last checked for updates */
-               last_checked = g_strdup_printf (_("Last checked: %s"), tmp);
-               g_free (tmp);
+               if (tmp != NULL) {
+                       gchar *last_checked;
 
-               widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "label_updates_last_checked"));
-               gtk_label_set_label (GTK_LABEL (widget), last_checked);
-               g_free (last_checked);
+                       /* TRANSLATORS: This is the time when we last checked for updates */
+                       last_checked = g_strdup_printf (_("Last checked: %s"), tmp);
+                       gtk_label_set_label (GTK_LABEL (widget), last_checked);
+                       g_free (last_checked);
+               }
+               gtk_widget_set_visible (widget, tmp != NULL);
+               g_free (tmp);
        }
 }
 


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