anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

commit 43df3975f35b588b38f31d90ee03aca263619238
parent 0d74e89628f3e6162b9a830f1f45a226b1c92826
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  4 Aug 2026 09:52:16 +0200

use GtkPicture

Diffstat:
Mcontrib/anastasis-gtk.cmb | 11++++++-----
Mcontrib/anastasis_gtk_auth_add_totp.ui | 6+++---
Mcontrib/anastasis_gtk_main_window.ui | 5+++--
Msrc/anastasis/anastasis-gtk_action.c | 6+++---
Msrc/anastasis/anastasis-gtk_handle-method-totp.c | 6+++---
Msrc/anastasis/anastasis-gtk_helper.c | 6+++---
Msrc/anastasis/anastasis-gtk_helper.h | 10+++++++---
7 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/contrib/anastasis-gtk.cmb b/contrib/anastasis-gtk.cmb @@ -183,7 +183,7 @@ (7,5,"GtkBox",None,3,None,None,None,1,None,None), (7,6,"GtkLabel",None,5,None,None,None,0,None,None), (7,7,"GtkEntry","anastasis_gtk_b_totp_dialog_name_entry",5,None,None,None,1,None,None), - (7,8,"GtkImage","qr_image",5,None,None,None,2,None,None), + (7,8,"GtkPicture","qr_image",5,None,None,None,2,None,None), (7,9,"GtkBox",None,3,None,None,None,2,None,None), (7,10,"GtkLabel",None,9,None,None,None,0,None,None), (7,11,"GtkEntry","totp_entry",9,None,None,None,1,None,None), @@ -701,7 +701,7 @@ (16,304,"GtkImage",None,303,None,None,None,0,None,None), (16,305,"GtkLabel",None,303,None,None,None,1,None,None), (16,306,"GtkViewport",None,291,None,None,None,3,None,None), - (16,307,"GtkImage","anastasis_gtk_secret_qr_image",306,None,None,None,0,None,None), + (16,307,"GtkPicture","anastasis_gtk_secret_qr_image",306,None,None,None,0,None,None), (16,308,"GtkLabel","anastasis_gtk_backup_success_label",276,None,"label",None,1,None,None), (16,309,"GtkFrame","anastasis_gtk_select_secret_frame",59,None,None,None,10,None,None), (16,310,"GtkBox","anastasis_gtk_secret_select_vbox",309,None,None,None,0,None,None), @@ -1241,8 +1241,8 @@ (7,7,"GtkWidget","margin-start","25",0,None,None,None,None,None,None,None,None), (7,7,"GtkWidget","margin-top","5",0,None,None,None,None,None,None,None,None), (7,7,"GtkWidget","vexpand","1",0,None,None,None,None,None,None,None,None), - (7,8,"GtkImage","icon-name","image-missing",0,None,None,None,None,None,None,None,None), - (7,8,"GtkImage","icon-size","large",0,None,None,None,None,None,None,None,None), + (7,8,"GtkPicture","can-shrink","0",0,None,None,None,None,None,None,None,None), + (7,8,"GtkPicture","content-fit","scale-down",0,None,None,None,None,None,None,None,None), (7,8,"GtkWidget","halign","center",0,None,None,None,None,None,None,None,None), (7,8,"GtkWidget","margin-bottom","30",0,None,None,None,None,None,None,None,None), (7,8,"GtkWidget","margin-end","25",0,None,None,None,None,None,None,None,None), @@ -2852,7 +2852,8 @@ (16,306,"GtkWidget","margin-bottom","5",0,None,None,None,None,None,None,None,None), (16,306,"GtkWidget","margin-top","5",0,None,None,None,None,None,None,None,None), (16,306,"GtkWidget","vexpand","1",0,None,None,None,None,None,None,None,None), - (16,307,"GtkImage","icon-name","image-missing",0,None,None,None,None,None,None,None,None), + (16,307,"GtkPicture","can-shrink","0",0,None,None,None,None,None,None,None,None), + (16,307,"GtkPicture","content-fit","scale-down",0,None,None,None,None,None,None,None,None), (16,307,"GtkWidget","height-request","400",0,None,None,None,None,None,None,None,None), (16,307,"GtkWidget","hexpand","1",0,None,None,None,None,None,None,None,None), (16,307,"GtkWidget","margin-bottom","10",0,None,None,None,None,None,None,None,None), diff --git a/contrib/anastasis_gtk_auth_add_totp.ui b/contrib/anastasis_gtk_auth_add_totp.ui @@ -82,10 +82,10 @@ import the TOTP secret it into your TOTP App.</property> </object> </child> <child> - <object class="GtkImage" id="qr_image"> + <object class="GtkPicture" id="qr_image"> + <property name="can-shrink">0</property> + <property name="content-fit">scale-down</property> <property name="halign">center</property> - <property name="icon-name">image-missing</property> - <property name="icon-size">large</property> <property name="margin-bottom">30</property> <property name="margin-end">25</property> <property name="margin-start">25</property> diff --git a/contrib/anastasis_gtk_main_window.ui b/contrib/anastasis_gtk_main_window.ui @@ -2304,10 +2304,11 @@ date of your secret's recovery data.</property> <child> <object class="GtkViewport"> <property name="child"> - <object class="GtkImage" id="anastasis_gtk_secret_qr_image"> + <object class="GtkPicture" id="anastasis_gtk_secret_qr_image"> + <property name="can-shrink">0</property> + <property name="content-fit">scale-down</property> <property name="height-request">400</property> <property name="hexpand">1</property> - <property name="icon-name">image-missing</property> <property name="margin-bottom">10</property> <property name="margin-end">10</property> <property name="margin-start">10</property> diff --git a/src/anastasis/anastasis-gtk_action.c b/src/anastasis/anastasis-gtk_action.c @@ -3379,7 +3379,7 @@ action_recovery_finished (void) GNUNET_JSON_spec_end () }; GdkPixbuf *pb; - GtkImage *img; + GtkPicture *img; AG_hide_all_frames (); name = json_string_value (json_object_get (json_object_get (AG_redux_state, @@ -3415,8 +3415,8 @@ action_recovery_finished (void) AG_show ("anastasis_gtk_secret_copy_button"); } pb = NULL; - img = GTK_IMAGE (GCG_get_main_window_object ( - "anastasis_gtk_secret_qr_image")); + img = GTK_PICTURE (GCG_get_main_window_object ( + "anastasis_gtk_secret_qr_image")); if (NULL != text) { pb = AG_setup_qrcode (GTK_WIDGET (img), diff --git a/src/anastasis/anastasis-gtk_handle-method-totp.c b/src/anastasis/anastasis-gtk_handle-method-totp.c @@ -187,7 +187,7 @@ refresh_totp (GtkBuilder *builder) char *uri; char base_sec[sizeof (totp_key) * 2]; GdkPixbuf *pb; - GtkImage *img; + GtkPicture *img; gtk_widget_set_sensitive ( GTK_WIDGET (gtk_builder_get_object (builder, @@ -205,8 +205,8 @@ refresh_totp (GtkBuilder *builder) u_name, base_sec); GNUNET_free (u_name); - img = GTK_IMAGE (gtk_builder_get_object (builder, - "qr_image")); + img = GTK_PICTURE (gtk_builder_get_object (builder, + "qr_image")); pb = AG_setup_qrcode (GTK_WIDGET (img), uri, strlen (uri)); diff --git a/src/anastasis/anastasis-gtk_helper.c b/src/anastasis/anastasis-gtk_helper.c @@ -431,14 +431,14 @@ AG_setup_qrcode (GtkWidget *w, void -AG_image_set_from_pixbuf (GtkImage *img, +AG_image_set_from_pixbuf (GtkPicture *img, GdkPixbuf *pb) { GdkTexture *texture; texture = gdk_texture_new_for_pixbuf (pb); - gtk_image_set_from_paintable (img, - GDK_PAINTABLE (texture)); + gtk_picture_set_paintable (img, + GDK_PAINTABLE (texture)); g_object_unref (texture); } diff --git a/src/anastasis/anastasis-gtk_helper.h b/src/anastasis/anastasis-gtk_helper.h @@ -196,14 +196,18 @@ AG_setup_qrcode (GtkWidget *w, /** - * Display @a pb in the GtkImage @a img. GTK4 images render paintables, + * Display @a pb in the GtkPicture @a img. GTK4 pictures render paintables, * so the pixbuf is wrapped in a texture first. * - * @param img image widget to update + * A GtkPicture and not a GtkImage: a GtkImage is an *icon* widget, it + * measures the icon size and ignores the intrinsic size of its paintable, + * which would render the QR code at 32x32 instead of its natural size. + * + * @param img picture widget to update * @param pb pixbuf to show */ void -AG_image_set_from_pixbuf (GtkImage *img, +AG_image_set_from_pixbuf (GtkPicture *img, GdkPixbuf *pb);