[gimp/gimp-2-10] app: only show a "Last checked" date when we did at least 1 check.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: only show a "Last checked" date when we did at least 1 check.
- Date: Thu, 13 Feb 2020 21:36:31 +0000 (UTC)
commit c5c67b9d6163f4a7d3b747cb347e4de710d64aad
Author: Jehan <jehan girinstud io>
Date: Tue Feb 11 21:12:42 2020 +0100
app: only show a "Last checked" date when we did at least 1 check.
If for instance you've got no internet connection or other reasons that
a check might fail, the check-update-timestamp will be 0, which is
1970-01-01.
Thanks to Alexandre Prokoudine for noticing it!
(cherry picked from commit ed778303813d07ac1eac4dfbcaa4ed86c5f12f1d)
app/dialogs/about-dialog.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
---
diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c
index 6e66ba5120..f65d2edb1c 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -278,8 +278,6 @@ about_dialog_add_update (GimpAboutDialog *dialog,
GDateTime *datetime;
gchar *date;
gchar *text;
- gchar *text2;
-
/* Get the dialog vbox. */
container = gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog));
@@ -359,19 +357,28 @@ about_dialog_add_update (GimpAboutDialog *dialog,
/* Show a check update button. */
gtk_box_reorder_child (GTK_BOX (vbox), frame, 4);
- datetime = g_date_time_new_from_unix_local (config->check_update_timestamp);
- date = g_date_time_format (datetime, "%x");
- text2 = g_strdup_printf (_("Last checked on %s"), date);
- text = g_strdup_printf ("%s\n<i>%s</i>",
- _("Check for updates"), text2);
+ if (config->check_update_timestamp > 0)
+ {
+ gchar *subtext;
+
+ datetime = g_date_time_new_from_unix_local (config->check_update_timestamp);
+ date = g_date_time_format (datetime, "%x");
+ subtext = g_strdup_printf (_("Last checked on %s"), date);
+ g_date_time_unref (datetime);
+ g_free (date);
+
+ text = g_strdup_printf ("%s\n<i>%s</i>",
+ _("Check for updates"), subtext);
+ g_free (subtext);
+ }
+ else
+ {
+ text = g_strdup_printf ("%s", _("Check for updates"));
+ }
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), text);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
-
- g_date_time_unref (datetime);
- g_free (date);
g_free (text);
- g_free (text2);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]