File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,20 +106,20 @@ sub get_body_text {
106106sub get_html_source {
107107 my ($self ) = @_ ;
108108
109- my $html_source ;
110109 my $resource = $self -> view-> get_main_resource();
111- my $done = 0;
112110
113111 return ' ' unless $resource ;
114112
115- $resource -> get_data(undef , sub {
116- my ($resource , $result , $user_data ) = @_ ;
113+ my $result ;
117114
118- $html_source = $ resource-> get_data_finish( $result );
119- $done = 1;
115+ $ resource-> get_data( undef , sub {
116+ $result = $_ [1]; # store GAsyncResult, used for the _finish call later
120117 }, undef );
121118
122- Gtk3::main_iteration while Gtk3::events_pending or not $done ;
119+ # wait for the callback to fire
120+ Gtk3::main_iteration while Gtk3::events_pending or not defined $result ;
121+
122+ my $html_source = $resource -> get_data_finish($result );
123123
124124 # get_data_finish returns a byte-array, turn it into a human readable string
125125 my $html_string = decode_utf8(join (' ' , map chr , @$html_source ));
You can’t perform that action at this time.
0 commit comments