Commit ed778303 authored by Jehan's avatar Jehan

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!
parent 49588963
Pipeline #151196 passed with stages
in 43 minutes and 12 seconds
......@@ -268,8 +268,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));
......@@ -349,19 +347,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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment