Skip Menu |

This queue is for tickets about the circle-fe-gtk CPAN distribution.

Report information
The Basics
Id: 123626
Status: patched
Priority: 0/
Queue: circle-fe-gtk

People
Owner: Nobody in particular
Requestors: TEAM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.130560
Fixed in: (no value)



Subject: Tangence API patches
Simple (and somewhat untidy) patch to get ::Gtk working with the current Tangence API. Able to start up and connect, entry box and tabs work... probably a few issues remaining. (patch is against current bzr head with the exception of the Perl => GPL license change in Build.PL)
Subject: 2017-11-14-circle-frontend-gtk-tangence-api.diff

Message body is not shown because it is too large.

On Tue Nov 14 10:34:03 2017, TEAM wrote: Show quoted text
> Simple (and somewhat untidy) patch to get ::Gtk working with the > current Tangence API. > > Able to start up and connect, entry box and tabs work... probably a > few issues remaining. > > (patch is against current bzr head with the exception of the Perl => > GPL license change in Build.PL)
That *mostly* looks OK give or take style fixes which I can do. I might see if I can find some objects to ->adopt_future on instead of Variable::Disposition though. One question: why the two deleted lines in the theme file? -- Paul Evans
On Tue Nov 14 13:32:46 2017, PEVANS wrote: Show quoted text
> That *mostly* looks OK give or take style fixes which I can do. I > might see if I can find some objects to ->adopt_future on instead of > Variable::Disposition though.
I've taken the spirit of the changes and adjusted them to use the form retain_future $obj->some_method(...); so as to have a much smaller overall diff. See attached. -- Paul Evans
Subject: rt123626.patch
=== modified file 'Build.PL' --- Build.PL 2017-11-14 18:17:43 +0000 +++ Build.PL 2017-11-14 18:49:24 +0000 @@ -12,7 +12,7 @@ 'IO::Async' => '0.14', 'IO::Async::Loop::Glib' => 0, 'Module::Pluggable' => 0, - 'Net::Async::Tangence::Client' => '0.08', + 'Net::Async::Tangence::Client' => '0.13', 'Tangence::ObjectProxy' => '0.18', }, auto_configure_requires => 0, # Don't add M::B to configure_requires === modified file 'bin/circle-fe-gtk' --- bin/circle-fe-gtk 2013-02-26 22:35:10 +0000 +++ bin/circle-fe-gtk 2017-11-14 18:49:24 +0000 @@ -10,7 +10,8 @@ use Glib qw( TRUE FALSE ); use Gtk2 qw( init ); -use Net::Async::Tangence::Client; +use Net::Async::Tangence::Client 0.13; # Future-returning API +use Variable::Disposition qw( retain_future ); use Circle::FE::Gtk::Tab; @@ -171,25 +172,21 @@ return 0; } ); -$conn->connect_url( $URL ); +my $f = $conn->connect_url( $URL ); $mainwin->show_all; +$f->get; + my $rootobj; $loop->loop_once until $rootobj = $conn->rootobj; -my $session; -$rootobj->call_method( - method => "get_session", - args => [ [ 'tabs' ] ], - on_result => sub { - ( $session ) = @_; - } -); -$loop->loop_once until $session; +my $session = $rootobj->call_method( + get_session => [qw( tabs )], +)->get; -$session->watch_property( - property => "tabs", +$session->watch_property_with_initial( + 'tabs', on_set => sub { my ( $objarray ) = @_; @@ -228,7 +225,7 @@ }, on_splice => sub { my ( $index, $count, @objs ) = @_; - + $notebook->remove_page( $index ) for 1 .. $count; my @newtabs; @@ -249,10 +246,9 @@ splice @tabs, $index+$delta, 0, ( splice @tabs, $index, 1, () ); }, - want_initial => 1, -); +)->get; -$loop->loop_forever; +$loop->run; sub new_tab { @@ -266,20 +262,19 @@ $tab->set_label_text( "Global" ); } else { - $obj->watch_property( - property => "tag", + retain_future $obj->watch_property_with_initial( + 'tag', on_set => sub { my ( $newtag ) = @_; $tab->set_label_text( $newtag ); }, - want_initial => 1, ); } my $widget = $tab->get_widget; - $obj->subscribe_event( - event => "destroy", + retain_future $obj->subscribe_event( + 'destroy', on_fire => sub { while( ( my $pagenum = $notebook->page_num( $widget ) ) > -1 ) { $notebook->remove_page( $pagenum ); === modified file 'lib/Circle/FE/Gtk/Tab.pm' --- lib/Circle/FE/Gtk/Tab.pm 2013-02-26 22:35:10 +0000 +++ lib/Circle/FE/Gtk/Tab.pm 2017-11-14 18:49:24 +0000 @@ -11,6 +11,7 @@ use File::ShareDir qw( dist_file ); +use Variable::Disposition qw( retain_future ); use Module::Pluggable search_path => "Circle::FE::Gtk::Widget", sub_name => "widgets", require => 1; @@ -55,14 +56,12 @@ root => Gtk2::VBox->new(), }, $class; - $object->call_method( - method => "get_widget", - args => [], - on_result => sub { - $self->{root}->add( $self->build_widget( $_[0] ) ); - $self->{root}->show_all; - } - ); + retain_future $object->call_method( + get_widget => () + )->on_done(sub { + $self->{root}->add( $self->build_widget( $_[0] ) ); + $self->{root}->show_all; + }); return $self; } @@ -101,13 +100,12 @@ my $label = $self->{label} = Gtk2::Label->new(""); my $object = $self->{object}; - $object->watch_property( - property => "level", + retain_future $object->watch_property_with_initial( + "level", on_set => sub { my ( $level ) = @_; $label->modify_fg( $_ => $self->get_theme_colour( "level$level" ) ) for qw( normal active ); }, - want_initial => 1, ); return $label; @@ -128,10 +126,8 @@ my $object = $self->{object}; if( $object->prop("level") > 0 ) { - $object->call_method( - method => "reset_level", - args => [], - on_result => sub {}, # ignore + retain_future $object->call_method( + reset_level => () ); } } === modified file 'lib/Circle/FE/Gtk/Widget/Entry.pm' --- lib/Circle/FE/Gtk/Widget/Entry.pm 2010-06-14 18:28:31 +0000 +++ lib/Circle/FE/Gtk/Widget/Entry.pm 2017-11-14 18:49:24 +0000 @@ -7,6 +7,7 @@ use strict; use warnings; +use Variable::Disposition qw( retain_future ); use constant type => "Entry"; use Gtk2::Gdk::Keysyms; @@ -19,20 +20,18 @@ my $tabobj = $tab->{object}; my $widget = Gtk2::Entry->new(); - $obj->watch_property( - property => "text", + retain_future $obj->watch_property_with_initial( + "text", on_set => sub { my ( $text ) = @_; $text = "" unless defined $text; $widget->set_text( $text ); }, - want_initial => 1, ); - $obj->watch_property( - property => "history", + retain_future $obj->watch_property_with_initial( + "history", on_updated => sub {}, # We ignore this, we just want a local cache - want_initial => 1, ); my $autoclear = $obj->prop("autoclear"); @@ -41,16 +40,8 @@ $widget->signal_connect( activate => sub { - $obj->call_method( - method => "enter", - args => [ $widget->get_text ], - - on_result => sub {}, # IGNORE - - on_error => sub { - my ( $message ) = @_; - # TODO: write the error message somewhere - }, + retain_future $obj->call_method( + enter => $widget->get_text, ); $widget->set_text( "" ) if $autoclear; undef $history_index; === modified file 'lib/Circle/FE/Gtk/Widget/Label.pm' --- lib/Circle/FE/Gtk/Widget/Label.pm 2010-06-14 18:28:31 +0000 +++ lib/Circle/FE/Gtk/Widget/Label.pm 2017-11-14 18:49:24 +0000 @@ -8,6 +8,7 @@ use warnings; use constant type => "Label"; +use Variable::Disposition qw( retain_future ); sub build { @@ -15,10 +16,9 @@ my ( $obj, $tab ) = @_; my $widget = Gtk2::Label->new(""); - $obj->watch_property( - property => "text", - on_set => sub { $widget->set_text( $_[0] ) }, - want_initial => 1, + retain_future $obj->watch_property_with_initial( + "text", + on_set => sub { $widget->set_text( $_[0] ) }, ); return $widget; === modified file 'lib/Circle/FE/Gtk/Widget/Scroller.pm' --- lib/Circle/FE/Gtk/Widget/Scroller.pm 2012-09-15 02:38:40 +0000 +++ lib/Circle/FE/Gtk/Widget/Scroller.pm 2017-11-14 18:49:24 +0000 @@ -9,6 +9,7 @@ use constant type => "Scroller"; +use Variable::Disposition qw( retain_future ); use Glib qw( TRUE FALSE ); use POSIX qw( strftime ); @@ -54,8 +55,8 @@ $self->{start_para_mark} = $buffer->create_mark( "start_para", $buffer->get_end_iter, TRUE ); my $endmark = $buffer->create_mark( "end", $buffer->get_end_iter, FALSE ); - $obj->watch_property( - property => "displayevents", + retain_future $obj->watch_property_with_initial( + "displayevents", on_set => sub { $textview->set_buffer( Gtk2::TextBuffer->new( $buffer->get_tag_table ) ); $self->append_event( $_ ) for @{ $_[0] }; @@ -71,7 +72,6 @@ $self->shift_events( $_[0] ); }, on_splice => sub { 'TODO' }, - want_initial => 1, ); return $widget;