Fix about dialog

This commit is contained in:
Cassowary 2023-12-07 16:00:26 -08:00
parent af7dc8395d
commit 7600903f9b
3 changed files with 2 additions and 273 deletions

View File

@ -270,203 +270,6 @@ static void
about_dialog_add_update (PikaAboutDialog *dialog,
PikaCoreConfig *config)
{
GtkWidget *container;
GList *children;
GtkWidget *vbox;
GtkWidget *frame;
GtkWidget *box;
GtkWidget *box2;
GtkWidget *label;
GtkWidget *button;
GtkWidget *button_image;
GtkWidget *button_label;
GDateTime *datetime;
gchar *date;
gchar *text;
if (dialog->update_frame)
{
gtk_widget_destroy (dialog->update_frame);
dialog->update_frame = NULL;
}
/* Get the dialog vbox. */
container = gtk_dialog_get_content_area (GTK_DIALOG (dialog->dialog));
children = gtk_container_get_children (GTK_CONTAINER (container));
g_return_if_fail (GTK_IS_BOX (children->data));
vbox = children->data;
g_list_free (children);
/* 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);
/* Button in the frame. */
button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0);
gtk_widget_show (button);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (button), box2);
gtk_widget_show (box2);
button_image = gtk_image_new_from_icon_name (NULL, GTK_ICON_SIZE_DIALOG);
gtk_box_pack_start (GTK_BOX (box2), button_image, FALSE, FALSE, 0);
gtk_widget_show (button_image);
button_label = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (box2), button_label, FALSE, FALSE, 0);
gtk_container_child_set (GTK_CONTAINER (box2), button_label, "expand", TRUE, NULL);
gtk_widget_show (button_label);
if (config->last_known_release != NULL)
{
/* There is a newer version. */
const gchar *download_url = NULL;
gchar *comment = NULL;
/* We want the frame to stand out. */
label = gtk_label_new (NULL);
text = g_strdup_printf ("<tt><b><big>%s</big></b></tt>",
_("Update 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, 3);
/* Button is an update link. */
gtk_image_set_from_icon_name (GTK_IMAGE (button_image),
"software-update-available",
GTK_ICON_SIZE_DIALOG);
#ifdef PIKA_UNSTABLE
download_url = "https://heckin.technology/AlderconeStudio/PIKApp/";
#else
download_url = "https://heckin.technology/AlderconeStudio/PIKApp/";
#endif
g_signal_connect (button, "clicked",
(GCallback) about_dialog_download_clicked,
(gpointer) download_url);
/* The preferred localized date representation without the time. */
datetime = g_date_time_new_from_unix_local (config->last_release_timestamp);
date = g_date_time_format (datetime, "%x");
g_date_time_unref (datetime);
if (config->last_revision > 0)
{
/* This is actually a new revision of current version. */
text = g_strdup_printf (_("Download PIKA %s revision %d (released on %s)\n"),
config->last_known_release,
config->last_revision,
date);
/* Finally an optional release comment. */
if (config->last_release_comment)
{
/* Translators: <> tags are Pango markup. Please keep these
* markups in your translation. */
comment = g_strdup_printf (_("<u>Release comment</u>: <i>%s</i>"), config->last_release_comment);
}
}
else
{
text = g_strdup_printf (_("Download PIKA %s (released on %s)\n"),
config->last_known_release, date);
}
gtk_label_set_text (GTK_LABEL (button_label), text);
g_free (text);
g_free (date);
if (comment)
{
label = gtk_label_new (NULL);
gtk_label_set_max_width_chars (GTK_LABEL (label), 80);
gtk_label_set_markup (GTK_LABEL (label), comment);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
g_free (comment);
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
gtk_widget_show (label);
}
}
else
{
/* Button is a "Check for updates" action. */
gtk_image_set_from_icon_name (GTK_IMAGE (button_image),
"view-refresh",
GTK_ICON_SIZE_MENU);
gtk_label_set_text (GTK_LABEL (button_label), _("Check for updates"));
g_signal_connect_swapped (button, "clicked",
(GCallback) pika_update_check, config);
}
gtk_box_reorder_child (GTK_BOX (vbox), frame, 4);
/* Last check date box. */
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
if (config->last_known_release != NULL)
gtk_widget_set_margin_top (box2, 20);
gtk_container_add (GTK_CONTAINER (box), box2);
gtk_widget_show (box2);
/* Show a small "Check for updates" button only if the big one has
* been replaced by a download button.
*/
if (config->last_known_release != NULL)
{
button = gtk_button_new_from_icon_name ("view-refresh", GTK_ICON_SIZE_MENU);
gtk_widget_set_tooltip_text (button, _("Check for updates"));
gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
g_signal_connect_swapped (button, "clicked",
(GCallback) pika_update_check, config);
gtk_widget_show (button);
}
if (config->check_update_timestamp > 0)
{
gchar *subtext;
gchar *time;
datetime = g_date_time_new_from_unix_local (config->check_update_timestamp);
date = g_date_time_format (datetime, "%x");
time = g_date_time_format (datetime, "%X");
/* Translators: first string is the date in the locale's date
* representation (e.g., 12/31/99), second is the time in the
* locale's time representation (e.g., 23:13:48).
*/
subtext = g_strdup_printf (_("Last checked on %s at %s"), date, time);
g_date_time_unref (datetime);
g_free (date);
g_free (time);
text = g_strdup_printf ("<i>%s</i>", subtext);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), text);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
gtk_container_child_set (GTK_CONTAINER (box2), label, "expand", TRUE, NULL);
gtk_widget_show (label);
g_free (text);
g_free (subtext);
}
gtk_widget_show (box);
gtk_widget_show (frame);
g_set_weak_pointer (&dialog->update_frame, frame);
/* Reconstruct the dialog when release info changes. */
g_signal_connect (config, "notify::last-known-release",
(GCallback) about_dialog_last_release_changed,
dialog);
}
static void
@ -631,80 +434,6 @@ decorate_text (PikaAboutDialog *dialog,
static gboolean
about_dialog_timer (gpointer data)
{
PikaAboutDialog *dialog = data;
gint timeout = 0;
if (dialog->animstep == 0)
{
gchar *text = NULL;
dialog->visible = TRUE;
switch (dialog->state)
{
case 0:
dialog->timer = g_timeout_add (30, about_dialog_timer, dialog);
dialog->state += 1;
return FALSE;
case 1:
text = insert_spacers (_("PIKA is brought to you by"));
dialog->state += 1;
break;
default:
g_return_val_if_reached (TRUE);
break;
}
g_return_val_if_fail (text != NULL, TRUE);
pango_layout_set_text (dialog->layout, text, -1);
pango_layout_set_attributes (dialog->layout, NULL);
g_free (text);
}
if (dialog->animstep < 16)
{
decorate_text (dialog, 2, ((gfloat) dialog->animstep) / 15.0);
}
else if (dialog->animstep == 16)
{
timeout = 800;
}
else if (dialog->animstep == 17)
{
timeout = 30;
}
else if (dialog->animstep < 33)
{
decorate_text (dialog, 1,
1.0 - ((gfloat) (dialog->animstep - 17)) / 15.0);
}
else if (dialog->animstep == 33)
{
dialog->visible = FALSE;
timeout = 300;
}
else
{
dialog->visible = FALSE;
dialog->animstep = -1;
timeout = 30;
}
dialog->animstep++;
gtk_widget_queue_draw (dialog->anim_area);
if (timeout > 0)
{
dialog->timer = g_timeout_add (timeout, about_dialog_timer, dialog);
return FALSE;
}
/* else keep the current timeout */
return TRUE;
}

View File

@ -5101,7 +5101,7 @@ register_image_procs (PikaPDB *pdb)
"pika-image-get-imported-file");
pika_procedure_set_static_help (procedure,
"Returns the imported file for the specified image.",
"This procedure returns the file associated with the specified image if the image was imported from a non-native Pika format. If the image was not imported, or has since been saved in the native Pika format, this procedure returns %NULL.",
"This procedure returns the file associated with the specified image if the image was imported from a non-native Pika format. If the image was not imported, or has since been saved in the native Gimp format, this procedure returns %NULL.",
NULL);
pika_procedure_set_static_attribution (procedure,
"Eric Grivel <pika@lumenssolutions.com>",

View File

@ -47,7 +47,6 @@
#include <libpika/pikafont_pdb.h>
#include <libpika/pikafonts_pdb.h>
#include <libpika/pikafontselect_pdb.h>
#include <libpika/pikapikarc_pdb.h>
#include <libpika/pikagradient_pdb.h>
#include <libpika/pikagradients_pdb.h>
#include <libpika/pikagradientselect_pdb.h>
@ -72,6 +71,7 @@
#include <libpika/pikapattern_pdb.h>
#include <libpika/pikapatterns_pdb.h>
#include <libpika/pikapatternselect_pdb.h>
#include <libpika/pikapikarc_pdb.h>
#include <libpika/pikaprogress_pdb.h>
#include <libpika/pikaresource_pdb.h>
#include <libpika/pikaselection_pdb.h>