[gimp] app: show the About dialog at startup when a new version is available.



commit 6b237b90fd8086136d19925e59bb3c90cc143ee8
Author: Jehan <jehan girinstud io>
Date:   Sun Dec 29 13:41:59 2019 +0100

    app: show the About dialog at startup when a new version is available.
    
    This about dialog will complain an explicit message about the new
    version and a link button to go to the download page.

 app/gimp-update.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
---
diff --git a/app/gimp-update.c b/app/gimp-update.c
index 471bfbf20b..5f5788aab3 100644
--- a/app/gimp-update.c
+++ b/app/gimp-update.c
@@ -24,12 +24,20 @@
 #include <json-glib/json-glib.h>
 #include <stdio.h>
 
+#ifndef GIMP_CONSOLE_COMPILATION
+#include <gtk/gtk.h>
+#endif
+
 #include "libgimpbase/gimpbase.h"
 
 #include "core/core-types.h"
 
 #include "config/gimpcoreconfig.h"
 
+#ifndef GIMP_CONSOLE_COMPILATION
+#include "dialogs/about-dialog.h"
+#endif
+
 #include "gimp-intl.h"
 #include "gimp-update.h"
 
@@ -162,6 +170,27 @@ gimp_check_updates_callback (GObject      *source,
     }
 }
 
+static void
+gimp_update_about_dialog (GimpCoreConfig   *config,
+                          const GParamSpec *pspec,
+                          gpointer          user_data)
+{
+  g_signal_handlers_disconnect_by_func (config,
+                                        (GCallback) gimp_update_about_dialog,
+                                        NULL);
+
+  if (config->last_known_release != NULL)
+    {
+#ifndef GIMP_CONSOLE_COMPILATION
+      gtk_widget_show (about_dialog_create (config));
+#else
+      g_warning (_("A new version of GIMP (%s) was released.\n"
+                   "It is recommended to update."),
+                 config->last_known_release);
+#endif
+    }
+}
+
 /*
  * gimp_update_auto_check:
  * @config:
@@ -192,6 +221,10 @@ gimp_update_auto_check (GimpCoreConfig *config)
     return FALSE;
 #endif
 
+  g_signal_connect (config, "notify::last-known-release",
+                    (GCallback) gimp_update_about_dialog,
+                    NULL);
+
   return gimp_update_check (config);
 }
 


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