[gimp] app: always show the "Check for updates" button in the About dialog.



commit 2900f2a868a7790719f6ad8cf95eea6b09cffa6e
Author: Jehan <jehan girinstud io>
Date:   Sat Feb 8 14:17:17 2020 +0100

    app: always show the "Check for updates" button in the About dialog.
    
    Even when we already notify of an update, we should leave the ability to
    query the last gimp_versions.json manually.
    It would allow also people who disabled automatic check at startup
    (whether through preferences or because the build disabled the feature
    altogether) to still make update checks, and to not be forever stuck
    with the result of an outdated version check.

 app/dialogs/about-dialog.c | 54 ++++++++++++++++++++++++----------------------
 1 file changed, 28 insertions(+), 26 deletions(-)
---
diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c
index 309eed01c7..6243996bbe 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -264,9 +264,12 @@ about_dialog_add_update (GimpAboutDialog *dialog,
   GtkWidget *frame;
   GtkWidget *box;
   GtkWidget *label;
+  GtkWidget *button;
   GDateTime *datetime;
   gchar     *date;
   gchar     *text;
+  gchar     *text2;
+
 
   /* Get the dialog vbox. */
   container = gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog));
@@ -331,6 +334,7 @@ about_dialog_add_update (GimpAboutDialog *dialog,
         }
       label = gtk_label_new (text);
       g_free (text);
+      g_free (date);
 
       gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
       gtk_widget_show (label);
@@ -341,37 +345,35 @@ about_dialog_add_update (GimpAboutDialog *dialog,
       gtk_box_pack_start (GTK_BOX (box), link, FALSE, FALSE, 0);
       gtk_widget_show (link);
     }
-  else
-    {
-      /* Show a check update version. */
-      GtkWidget *button;
-      gchar     *text2;
 
-      gtk_box_reorder_child (GTK_BOX (vbox), frame, 4);
+  /* Show a check update button. */
+  gtk_box_reorder_child (GTK_BOX (vbox), frame, 4);
 
-      text2 = g_strdup_printf (_("Last checked on %s"), date);
-      text = g_strdup_printf ("%s\n<i>%s</i>",
-                              _("Check for updates"), text2);
+  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);
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), text);
+  gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
 
-      label = gtk_label_new (NULL);
-      gtk_label_set_markup (GTK_LABEL (label), text);
-      gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
-      g_free (text);
-      g_free (text2);
+  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);
-      gtk_widget_show (label);
+  button = gtk_button_new ();
+  gtk_container_add (GTK_CONTAINER (button), label);
+  gtk_widget_show (label);
 
-      g_signal_connect (config, "notify::last-known-release",
-                        (GCallback) about_dialog_last_release_changed,
-                        dialog);
-      g_signal_connect_swapped (button, "clicked",
-                                (GCallback) gimp_update_check, config);
-      gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
-      gtk_widget_show (button);
-    }
-  g_free (date);
+  g_signal_connect (config, "notify::last-known-release",
+                    (GCallback) about_dialog_last_release_changed,
+                    dialog);
+  g_signal_connect_swapped (button, "clicked",
+                            (GCallback) gimp_update_check, config);
+  gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
+  gtk_widget_show (button);
 
   gtk_widget_show (box);
   gtk_widget_show (frame);


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