File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 11import GLib from "gi://GLib" ;
22import Gdk from "gi://Gdk?version=4.0" ;
33import Gio from "gi://Gio" ;
4+ import Gtk from "gi://Gtk?version=4.0" ;
45import Soup from "gi://Soup" ;
56
67// https://picsum.photos/
@@ -14,19 +15,20 @@ Gio._promisify(
1415
1516const image_bytes = await getImageBytes ( IMAGE_URL ) ;
1617const texture = Gdk . Texture . new_from_bytes ( image_bytes ) ;
17- workbench . builder . get_object ( "picture" ) . set_paintable ( texture ) ;
18+ workbench . builder . get_object < Gtk . Picture > ( "picture" ) . set_paintable ( texture ) ;
1819
1920async function getImageBytes ( url ) {
2021 const session = new Soup . Session ( ) ;
2122 const message = new Soup . Message ( {
2223 method : "GET" ,
2324 uri : GLib . Uri . parse ( url , GLib . UriFlags . NONE ) ,
2425 } ) ;
26+ // @ts -expect-error undetected async function
2527 const bytes = await session . send_and_read_async (
2628 message ,
2729 GLib . PRIORITY_DEFAULT ,
2830 null ,
29- ) ;
31+ ) as GLib . Bytes ;
3032 const status = message . get_status ( ) ;
3133 if ( status !== Soup . Status . OK ) {
3234 throw new Error ( `Got ${ status } , ${ message . reason_phrase } ` ) ;
You can’t perform that action at this time.
0 commit comments