app: let's display the release comment in update notification…

… when there is one such comment.
This commit is contained in:
Jehan
2020-03-30 15:37:34 +02:00
parent a05b085112
commit 75a03b02f4
4 changed files with 37 additions and 2 deletions

View File

@ -131,6 +131,7 @@ enum
PROP_CHECK_UPDATES,
PROP_CHECK_UPDATE_TIMESTAMP,
PROP_LAST_RELEASE_TIMESTAMP,
PROP_LAST_RELEASE_COMMENT,
PROP_LAST_REVISION,
PROP_LAST_KNOWN_RELEASE,
@ -702,6 +703,13 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
0, G_MAXINT64, 0,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_STRING (object_class, PROP_LAST_RELEASE_COMMENT,
"last-release-comment",
"Comment for last release",
LAST_KNOWN_RELEASE_BLURB,
NULL,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_STRING (object_class, PROP_LAST_KNOWN_RELEASE,
"last-known-release",
"last known release of GIMP",
@ -1103,6 +1111,9 @@ gimp_core_config_set_property (GObject *object,
case PROP_LAST_RELEASE_TIMESTAMP:
core_config->last_release_timestamp = g_value_get_int64 (value);
break;
case PROP_LAST_RELEASE_COMMENT:
core_config->last_release_comment = g_value_dup_string (value);
break;
case PROP_LAST_REVISION:
core_config->last_revision = g_value_get_int (value);
break;
@ -1330,6 +1341,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_LAST_RELEASE_TIMESTAMP:
g_value_set_int64 (value, core_config->last_release_timestamp);
break;
case PROP_LAST_RELEASE_COMMENT:
g_value_set_string (value, core_config->last_release_comment);
break;
case PROP_LAST_REVISION:
g_value_set_int (value, core_config->last_revision);
break;

View File

@ -108,6 +108,7 @@ struct _GimpCoreConfig
gint64 check_update_timestamp;
gchar *last_known_release;
gint64 last_release_timestamp;
gchar *last_release_comment;
gint last_revision;
};

View File

@ -337,11 +337,27 @@ about_dialog_add_update (GimpAboutDialog *dialog,
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* Finally the download link. */
/* 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);
/* Finally an optional release comment. */
if (config->last_release_comment)
{
/* Translators: <> tags are Pango markup. Please keep these
* markups in your translation. */
text = g_strdup_printf (_("<u>Release comment</u>: <i>%s</i>"), config->last_release_comment);
label = gtk_label_new (NULL);
gtk_label_set_max_width_chars (GTK_LABEL (label), 80);
gtk_label_set_markup (GTK_LABEL (label), text);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
g_free (text);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
gtk_widget_show (label);
}
}
/* Show a check update button. */

View File

@ -172,7 +172,8 @@ gimp_check_updates_callback (GObject *source,
*/
if (gimp_version_break (last_version, &major, &minor, &micro))
{
const gchar *build_date = NULL;
const gchar *build_date = NULL;
const gchar *build_comment = NULL;
GDateTime *datetime;
gchar *str;
@ -201,6 +202,8 @@ gimp_check_updates_callback (GObject *source,
build_revision = json_object_get_int_member (build, "revision");
if (json_object_has_member (build, "date"))
build_date = json_object_get_string_member (build, "date");
if (json_object_has_member (build, "comment"))
build_comment = json_object_get_string_member (build, "comment");
break;
}
}
@ -221,6 +224,7 @@ gimp_check_updates_callback (GObject *source,
"last-release-timestamp", g_date_time_to_unix (datetime),
"last-known-release", last_version,
"last-revision", build_revision,
"last-release-comment", build_comment,
NULL);
g_date_time_unref (datetime);
}