[gimp] app: show new version availability in About dialog.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: show new version availability in About dialog.
- Date: Sun, 29 Dec 2019 09:37:23 +0000 (UTC)
commit 826ece3b86b21a7f8c9671fcf53566382298b030
Author: Jehan <jehan girinstud io>
Date: Sat Dec 28 23:15:50 2019 +0100
app: show new version availability in About dialog.
I was wondering which shape should take the new version notification
(again some ugly pop-up?!) and realized using the About dialog was a
good idea.
This is preparatory work for this to happen.
app/dialogs/about-dialog.c | 84 +++++++++++++++++++++++++++++++++++++-
app/dialogs/about-dialog.h | 2 +-
app/dialogs/dialogs-constructors.c | 2 +-
3 files changed, 84 insertions(+), 4 deletions(-)
---
diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c
index 6718f34aaa..7ec494313b 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -28,6 +28,8 @@
#include "dialogs-types.h"
+#include "config/gimpcoreconfig.h"
+
#include "about.h"
#include "git-version.h"
@@ -70,6 +72,9 @@ static void about_dialog_unmap (GtkWidget *widget,
static GdkPixbuf * about_dialog_load_logo (void);
static void about_dialog_add_animation (GtkWidget *vbox,
GimpAboutDialog *dialog);
+static void about_dialog_add_update (GtkWidget *vbox,
+ GimpCoreConfig *config,
+ GimpAboutDialog *dialog);
static gboolean about_dialog_anim_draw (GtkWidget *widget,
cairo_t *cr,
GimpAboutDialog *dialog);
@@ -83,7 +88,7 @@ static void about_dialog_add_unstable_message
GtkWidget *
-about_dialog_create (void)
+about_dialog_create (GimpCoreConfig *config)
{
static GimpAboutDialog dialog;
@@ -148,6 +153,8 @@ about_dialog_create (void)
if (GTK_IS_BOX (children->data))
{
+ about_dialog_add_update (children->data,
+ config, &dialog);
about_dialog_add_animation (children->data, &dialog);
#ifdef GIMP_UNSTABLE
about_dialog_add_unstable_message (children->data);
@@ -225,7 +232,7 @@ about_dialog_add_animation (GtkWidget *vbox,
dialog->anim_area = gtk_drawing_area_new ();
gtk_box_pack_start (GTK_BOX (vbox), dialog->anim_area, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (vbox), dialog->anim_area, 4);
+ gtk_box_reorder_child (GTK_BOX (vbox), dialog->anim_area, 5);
gtk_widget_show (dialog->anim_area);
dialog->layout = gtk_widget_create_pango_layout (dialog->anim_area, NULL);
@@ -241,6 +248,79 @@ about_dialog_add_animation (GtkWidget *vbox,
dialog);
}
+static void
+about_dialog_add_update (GtkWidget *vbox,
+ GimpCoreConfig *config,
+ GimpAboutDialog *dialog)
+{
+ if (config->last_known_release != NULL)
+ {
+ /* There is a newer version. */
+ GtkWidget *link;
+ GtkWidget *box2;
+ GtkWidget *image;
+ GtkWidget *frame;
+ GtkWidget *box;
+ GtkWidget *label;
+ GDateTime *datetime;
+ gchar *date;
+ gchar *text;
+
+ /* The update frame. */
+ frame = gtk_frame_new (NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 2);
+
+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_container_add (GTK_CONTAINER (frame), box);
+
+ /* The preferred localized date representation without the time. */
+ datetime = g_date_time_new_from_unix_local (config->check_update_timestamp);
+ date = g_date_time_format (datetime, "%x");
+ g_date_time_unref (datetime);
+
+ /* We want the frame to stand out. */
+ label = gtk_label_new (NULL);
+ text = g_strdup_printf ("<tt><b><big>%s</big></b></tt>",
+ _("New version available!"));
+ gtk_label_set_markup (GTK_LABEL (label), text);
+ g_free (text);
+ gtk_widget_show (label);
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.5);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
+ gtk_box_reorder_child (GTK_BOX (vbox), frame, 2);
+
+ /* Explanation text with update image. */
+ box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_box_pack_start (GTK_BOX (box), box2, FALSE, FALSE, 0);
+ gtk_widget_show (box2);
+
+ image = gtk_image_new_from_icon_name ("software-update-available",
+ GTK_ICON_SIZE_DIALOG);
+ gtk_box_pack_start (GTK_BOX (box2), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+
+ text = g_strdup_printf (_("A new version of GIMP (%s) was released on %s.\n"
+ "It is recommended to update."),
+ config->last_known_release, date);
+ label = gtk_label_new (text);
+ g_free (date);
+ g_free (text);
+
+ gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ /* Finally the download link. */
+ link = gtk_link_button_new_with_label ("https://www.gimp.org/downloads/",
+ _("Go to download page"));
+ gtk_box_pack_start (GTK_BOX (box), link, FALSE, FALSE, 0);
+ gtk_widget_show (link);
+
+ gtk_widget_show (box);
+ gtk_widget_show (frame);
+ }
+}
+
static void
about_dialog_reshuffle (GimpAboutDialog *dialog)
{
diff --git a/app/dialogs/about-dialog.h b/app/dialogs/about-dialog.h
index 4f1d84d622..516d7da500 100644
--- a/app/dialogs/about-dialog.h
+++ b/app/dialogs/about-dialog.h
@@ -19,7 +19,7 @@
#define __ABOUT_DIALOG_H__
-GtkWidget * about_dialog_create (void);
+GtkWidget * about_dialog_create (GimpCoreConfig *config);
#endif /* __ABOUT_DIALOG_H__ */
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index 00319cdf5e..1df3f3186a 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -205,7 +205,7 @@ dialogs_about_get (GimpDialogFactory *factory,
GimpUIManager *ui_manager,
gint view_size)
{
- return about_dialog_create ();
+ return about_dialog_create (context->gimp->config);
}
GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]